diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-10-15 19:06:22 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-10-15 19:06:22 +0000 |
commit | 589bde0899cc72c7a5c253a6f1da4e0408de031f (patch) | |
tree | e3d4c23d04dea43b7db4505dcd641e273910bf32 /app | |
parent | 486a4dfbc82a5ffc5dd89f94bb44edd5a7f127cd (diff) | |
download | redmine-589bde0899cc72c7a5c253a6f1da4e0408de031f.tar.gz redmine-589bde0899cc72c7a5c253a6f1da4e0408de031f.zip |
Activity page to remember user's selection of activities (#1605).
git-svn-id: http://svn.redmine.org/redmine/trunk@14678 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/activities_controller.rb | 15 | ||||
-rw-r--r-- | app/models/user_preference.rb | 3 | ||||
-rw-r--r-- | app/views/activities/index.html.erb | 2 |
3 files changed, 18 insertions, 2 deletions
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index 717997d90..00d03487a 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -37,8 +37,21 @@ class ActivitiesController < ApplicationController @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, :with_subprojects => @with_subprojects, :author => @author) + pref = User.current.pref @activity.scope_select {|t| !params["show_#{t}"].nil?} - @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? + if @activity.scope.present? + if params[:submit].present? + pref.activity_scope = @activity.scope + pref.save + end + else + if @author.nil? + scope = pref.activity_scope & @activity.event_types + @activity.scope = scope.present? ? scope : :default + else + @activity.scope = :all + end + end events = @activity.events(@date_from, @date_to) diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index 3b671c244..80b3e6b9d 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -59,4 +59,7 @@ class UserPreference < ActiveRecord::Base def no_self_notified; (self[:no_self_notified] == true || self[:no_self_notified] == '1'); end def no_self_notified=(value); self[:no_self_notified]=value; end + + def activity_scope; Array(self[:activity_scope]) ; end + def activity_scope=(value); self[:activity_scope]=value ; end end diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index 0a996a052..830f408d3 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -61,7 +61,7 @@ <p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p> <% end %> <%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %> -<p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p> +<p><%= submit_tag l(:button_apply), :class => 'button-small', :name => 'submit' %></p> <% end %> <% end %> |