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
This commit is contained in:
Jean-Philippe Lang
2008-11-30 12:12:06 +00:00
parent fce4615f10
commit 6e777b7453
35 changed files with 76 additions and 7 deletions
+14 -3
View File
@@ -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