diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-11-30 12:12:06 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-11-30 12:12:06 +0000 |
commit | 6e777b745305b627c934d5585ca2083b482011d0 (patch) | |
tree | d44d3bc8d23ac9159dfa12afd316f7f3af15d45c /app/controllers/projects_controller.rb | |
parent | fce4615f10ad81b9070e65a45f9d37b1c571ccd7 (diff) | |
download | redmine-6e777b745305b627c934d5585ca2083b482011d0.tar.gz redmine-6e777b745305b627c934d5585ca2083b482011d0.zip |
Makes activity view accept a user_id param to show user's activity (#1002).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2067 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r-- | app/controllers/projects_controller.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a7efa4695..43e1ae035 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -227,10 +227,13 @@ class ProjectsController < ApplicationController @date_to ||= Date.today + 1 @date_from = @date_to - @days @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') + @author = (params[:user_id] ? User.find_active(params[:user_id]) : nil) - @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, :with_subprojects => @with_subprojects) + @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, + :with_subprojects => @with_subprojects, + :author => @author) @activity.scope_select {|t| !params["show_#{t}"].nil?} - @activity.default_scope! if @activity.scope.empty? + @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? events = @activity.events(@date_from, @date_to) @@ -240,10 +243,18 @@ class ProjectsController < ApplicationController render :layout => false if request.xhr? } format.atom { - title = (@activity.scope.size == 1) ? l("label_#{@activity.scope.first.singularize}_plural") : l(:label_activity) + title = l(:label_activity) + if @author + title = @author.name + elsif @activity.scope.size == 1 + title = l("label_#{@activity.scope.first.singularize}_plural") + end render_feed(events, :title => "#{@project || Setting.app_title}: #{title}") } end + + rescue ActiveRecord::RecordNotFound + render_404 end private |