summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-30 12:12:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-30 12:12:06 +0000
commit6e777b745305b627c934d5585ca2083b482011d0 (patch)
treed44d3bc8d23ac9159dfa12afd316f7f3af15d45c /app
parentfce4615f10ad81b9070e65a45f9d37b1c571ccd7 (diff)
downloadredmine-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')
-rw-r--r--app/controllers/projects_controller.rb17
-rw-r--r--app/views/projects/activity.rhtml5
2 files changed, 17 insertions, 5 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
diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml
index 5157dda7a..d067a6753 100644
--- a/app/views/projects/activity.rhtml
+++ b/app/views/projects/activity.rhtml
@@ -1,4 +1,4 @@
-<h2><%= l(:label_activity) %></h2>
+<h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, @author.to_s) %></h2>
<p class="subtitle"><%= "#{l(:label_date_from)} #{format_date(@date_to - @days)} #{l(:label_date_to).downcase} #{format_date(@date_to-1)}" %></p>
<div id="activity">
@@ -52,8 +52,9 @@
<p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p>
<%= hidden_field_tag 'with_subprojects', 0 %>
<% end %>
+<%= hidden_field_tag 'user_id', params[:user_id] %>
<p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
<% end %>
<% end %>
-<% html_title(l(:label_activity)) -%>
+<% html_title(l(:label_activity), @author) -%>