diff --git a/app/controllers/dmsf_state_controller.rb b/app/controllers/dmsf_state_controller.rb index b515e139..d1b4e027 100644 --- a/app/controllers/dmsf_state_controller.rb +++ b/app/controllers/dmsf_state_controller.rb @@ -26,9 +26,13 @@ class DmsfStateController < ApplicationController def user_pref_save member = @project.members.find(:first, :conditions => {:user_id => User.current.id}) - member.dmsf_mail_notification = params[:email_notify]; - member.save! - flash[:notice] = l(:notice_your_preferences_were_saved) + if member + member.dmsf_mail_notification = params[:email_notify]; + member.save! + flash[:notice] = l(:notice_your_preferences_were_saved) + else + flash[:warning] = l(:user_is_not_project_member) + end redirect_to :controller => "projects", :action => 'settings', :tab => 'dmsf', :id => @project end diff --git a/app/views/dmsf_state/_user_pref.html.erb b/app/views/dmsf_state/_user_pref.html.erb index 5933f266..1c276329 100644 --- a/app/views/dmsf_state/_user_pref.html.erb +++ b/app/views/dmsf_state/_user_pref.html.erb @@ -3,11 +3,15 @@ <% form_tag({:controller => "dmsf_state", :action => "user_pref_save", :id => @project}, :method=>:post) do %>
+ <% + member = @project.members.find(:first, :conditions => {:user_id => User.current.id}) + mail_notification = member ? member.dmsf_mail_notification : nil + %> <%= l(:label_notifications) %>: <%= select_tag("email_notify", options_for_select([[l(:select_option_default), nil], [l(:select_option_activated), true], [l(:select_option_deactivated), false]], - :selected => @project.members.find(:first, :conditions => {:user_id => User.current.id}).dmsf_mail_notification)) %> + :selected => mail_notification)) %> <%= submit_tag(l(:submit_save), :title => l(:title_save_preferences)) %>
<% end %> diff --git a/config/locales/cs.yml b/config/locales/cs.yml index b9f6530e..bce1a460 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -162,3 +162,5 @@ cs: # Not translated :label_physical_file_delete: "Physical file delete" + :user_is_not_project_member: "You are not member of the project" + \ No newline at end of file diff --git a/config/locales/de.yml b/config/locales/de.yml index 8eb9a6c0..62d2f22f 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -161,4 +161,5 @@ de: :warning_xapian_not_available: "Xapian not available" :menu_dmsf: "DMSF" :label_physical_file_delete: "Physical file delete" + :user_is_not_project_member: "You are not member of the project" \ No newline at end of file diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index ca54cf77..9257159c 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -155,4 +155,5 @@ en-GB: :warning_xapian_not_available: "Xapian not available" :menu_dmsf: "DMSF" :label_physical_file_delete: "Physical file delete" + :user_is_not_project_member: "You are not member of the project" \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 85616ed1..a1787bfa 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -159,4 +159,5 @@ en: :warning_xapian_not_available: "Xapian not available" :menu_dmsf: "DMSF" :label_physical_file_delete: "Physical file delete" + :user_is_not_project_member: "You are not member of the project" \ No newline at end of file diff --git a/config/locales/es.yml b/config/locales/es.yml index fe2ab0d2..403139c2 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -157,4 +157,5 @@ es: :warning_xapian_not_available: "Xapian not available" :menu_dmsf: "DMSF" :label_physical_file_delete: "Physical file delete" + :user_is_not_project_member: "You are not member of the project" \ No newline at end of file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index da55c0b5..973280c0 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -155,4 +155,5 @@ fr: :warning_xapian_not_available: "Xapian not available" :menu_dmsf: "DMSF" :label_physical_file_delete: "Physical file delete" + :user_is_not_project_member: "You are not member of the project" \ No newline at end of file diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 85616ed1..a1787bfa 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -159,4 +159,5 @@ en: :warning_xapian_not_available: "Xapian not available" :menu_dmsf: "DMSF" :label_physical_file_delete: "Physical file delete" + :user_is_not_project_member: "You are not member of the project" \ No newline at end of file diff --git a/config/locales/ru.yml b/config/locales/ru.yml index dc1974df..d2444ef2 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -155,4 +155,5 @@ ru: :warning_xapian_not_available: "Xapian not available" :menu_dmsf: "DMSF" :label_physical_file_delete: "Physical file delete" + :user_is_not_project_member: "You are not member of the project" \ No newline at end of file