From a8072b0d0f201754cfc6f0867b642fdb43af6054 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sun, 21 Feb 2021 01:45:16 +0000 Subject: [PATCH] Add an interface to filter activities by user (#33602). Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@20752 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/activities_helper.rb | 7 +++++++ app/views/activities/index.html.erb | 5 ++++- test/functional/activities_controller_test.rb | 1 + test/helpers/activities_helper_test.rb | 20 +++++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/helpers/activities_helper.rb b/app/helpers/activities_helper.rb index 49074b561..8f3e92362 100644 --- a/app/helpers/activities_helper.rb +++ b/app/helpers/activities_helper.rb @@ -30,4 +30,11 @@ module ActivitiesHelper end sorted_events end + + def activity_authors_options_for_select(project, selected) + options = [] + options += [["<< #{l(:label_me)} >>", User.current.id]] if User.current.logged? + options += Query.new(project: project).users.select{|user| user.active?}.map{|user| [user.name, user.id]} + options_for_select(options, selected) + end end diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index f71266004..e7f179ebe 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -36,6 +36,10 @@ <%= t(:label_days_to_html, :days => @days, :date => date_field_tag('from', '', :value => (@date_to - 1), :size => 10)) %> <%= calendar_for('from') %>

+

+ <%= l(:label_user) %> + <%= select_tag('user_id', activity_authors_options_for_select(@project, params[:user_id]), include_blank: true) %> +