From: Go MAEDA Date: Sun, 21 Feb 2021 01:45:16 +0000 (+0000) Subject: Add an interface to filter activities by user (#33602). X-Git-Tag: 4.2.0~82 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a8072b0d0f201754cfc6f0867b642fdb43af6054;p=redmine.git 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 --- 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) %> +