##// END OF EJS Templates
Makes activity view accept a user_id param to show user's activity (#1002)....
Jean-Philippe Lang -
r2065:6e777b745305
parent child
Show More
@@ -227,10 +227,13 class ProjectsController < ApplicationController
227 @date_to ||= Date.today + 1
227 @date_to ||= Date.today + 1
228 @date_from = @date_to - @days
228 @date_from = @date_to - @days
229 @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
229 @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
230 @author = (params[:user_id] ? User.find_active(params[:user_id]) : nil)
230
231
231 @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, :with_subprojects => @with_subprojects)
232 @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
233 :with_subprojects => @with_subprojects,
234 :author => @author)
232 @activity.scope_select {|t| !params["show_#{t}"].nil?}
235 @activity.scope_select {|t| !params["show_#{t}"].nil?}
233 @activity.default_scope! if @activity.scope.empty?
236 @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
234
237
235 events = @activity.events(@date_from, @date_to)
238 events = @activity.events(@date_from, @date_to)
236
239
@@ -240,10 +243,18 class ProjectsController < ApplicationController
240 render :layout => false if request.xhr?
243 render :layout => false if request.xhr?
241 }
244 }
242 format.atom {
245 format.atom {
243 title = (@activity.scope.size == 1) ? l("label_#{@activity.scope.first.singularize}_plural") : l(:label_activity)
246 title = l(:label_activity)
247 if @author
248 title = @author.name
249 elsif @activity.scope.size == 1
250 title = l("label_#{@activity.scope.first.singularize}_plural")
251 end
244 render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
252 render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
245 }
253 }
246 end
254 end
255
256 rescue ActiveRecord::RecordNotFound
257 render_404
247 end
258 end
248
259
249 private
260 private
@@ -1,4 +1,4
1 <h2><%= l(:label_activity) %></h2>
1 <h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, @author.to_s) %></h2>
2 <p class="subtitle"><%= "#{l(:label_date_from)} #{format_date(@date_to - @days)} #{l(:label_date_to).downcase} #{format_date(@date_to-1)}" %></p>
2 <p class="subtitle"><%= "#{l(:label_date_from)} #{format_date(@date_to - @days)} #{l(:label_date_to).downcase} #{format_date(@date_to-1)}" %></p>
3
3
4 <div id="activity">
4 <div id="activity">
@@ -52,8 +52,9
52 <p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p>
52 <p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p>
53 <%= hidden_field_tag 'with_subprojects', 0 %>
53 <%= hidden_field_tag 'with_subprojects', 0 %>
54 <% end %>
54 <% end %>
55 <%= hidden_field_tag 'user_id', params[:user_id] %>
55 <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
56 <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
56 <% end %>
57 <% end %>
57 <% end %>
58 <% end %>
58
59
59 <% html_title(l(:label_activity)) -%>
60 <% html_title(l(:label_activity), @author) -%>
@@ -692,3 +692,4 label_example: Example
692 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
692 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
693 permission_edit_own_messages: Edit own messages
693 permission_edit_own_messages: Edit own messages
694 permission_delete_own_messages: Delete own messages
694 permission_delete_own_messages: Delete own messages
695 label_user_activity: "%s's activity"
@@ -693,3 +693,4 label_example: Example
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
694 permission_edit_own_messages: Edit own messages
694 permission_edit_own_messages: Edit own messages
695 permission_delete_own_messages: Delete own messages
695 permission_delete_own_messages: Delete own messages
696 label_user_activity: "%s's activity"
@@ -697,3 +697,4 label_example: Example
697 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
697 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
698 permission_edit_own_messages: Edit own messages
698 permission_edit_own_messages: Edit own messages
699 permission_delete_own_messages: Delete own messages
699 permission_delete_own_messages: Delete own messages
700 label_user_activity: "%s's activity"
@@ -693,3 +693,4 label_example: Example
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
694 permission_edit_own_messages: Edit own messages
694 permission_edit_own_messages: Edit own messages
695 permission_delete_own_messages: Delete own messages
695 permission_delete_own_messages: Delete own messages
696 label_user_activity: "%s's activity"
@@ -694,3 +694,4 default_activity_development: Entwicklung
694 enumeration_issue_priorities: Ticket-Prioritäten
694 enumeration_issue_priorities: Ticket-Prioritäten
695 enumeration_doc_categories: Dokumentenkategorien
695 enumeration_doc_categories: Dokumentenkategorien
696 enumeration_activities: Aktivitäten (Zeiterfassung)
696 enumeration_activities: Aktivitäten (Zeiterfassung)
697 label_user_activity: "%s's activity"
@@ -344,6 +344,7 label_last_updates_plural: %d last updated
344 label_registered_on: Registered on
344 label_registered_on: Registered on
345 label_activity: Activity
345 label_activity: Activity
346 label_overall_activity: Overall activity
346 label_overall_activity: Overall activity
347 label_user_activity: "%s's activity"
347 label_new: New
348 label_new: New
348 label_logged_as: Logged in as
349 label_logged_as: Logged in as
349 label_environment: Environment
350 label_environment: Environment
@@ -677,3 +677,4 text_user_mail_option: "En los proyectos no seleccionados, sólo recibirá notif
677 text_user_wrote: '%s escribió:'
677 text_user_wrote: '%s escribió:'
678 text_wiki_destroy_confirmation: ¿Seguro que quiere borrar el wiki y todo su contenido?
678 text_wiki_destroy_confirmation: ¿Seguro que quiere borrar el wiki y todo su contenido?
679 text_workflow_edit: Seleccionar un flujo de trabajo para actualizar
679 text_workflow_edit: Seleccionar un flujo de trabajo para actualizar
680 label_user_activity: "%s's activity"
@@ -692,3 +692,4 label_example: Example
692 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
692 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
693 permission_edit_own_messages: Edit own messages
693 permission_edit_own_messages: Edit own messages
694 permission_delete_own_messages: Delete own messages
694 permission_delete_own_messages: Delete own messages
695 label_user_activity: "%s's activity"
@@ -170,7 +170,6 field_start_page: Page de démarrage
170 field_subproject: Sous-projet
170 field_subproject: Sous-projet
171 field_hours: Heures
171 field_hours: Heures
172 field_activity: Activité
172 field_activity: Activité
173 label_overall_activity: Activité globale
174 field_spent_on: Date
173 field_spent_on: Date
175 field_identifier: Identifiant
174 field_identifier: Identifiant
176 field_is_filter: Utilisé comme filtre
175 field_is_filter: Utilisé comme filtre
@@ -344,6 +343,8 label_last_updates: Dernière mise à jour
344 label_last_updates_plural: %d dernières mises à jour
343 label_last_updates_plural: %d dernières mises à jour
345 label_registered_on: Inscrit le
344 label_registered_on: Inscrit le
346 label_activity: Activité
345 label_activity: Activité
346 label_overall_activity: Activité globale
347 label_user_activity: "Activité de %s"
347 label_new: Nouveau
348 label_new: Nouveau
348 label_logged_as: Connecté en tant que
349 label_logged_as: Connecté en tant que
349 label_environment: Environnement
350 label_environment: Environnement
@@ -692,3 +692,4 label_example: Example
692 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
692 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
693 permission_edit_own_messages: Edit own messages
693 permission_edit_own_messages: Edit own messages
694 permission_delete_own_messages: Delete own messages
694 permission_delete_own_messages: Delete own messages
695 label_user_activity: "%s's activity"
@@ -693,3 +693,4 label_example: Példa
693 text_repository_usernames_mapping: "Állítsd be a felhasználó összerendeléseket a Redmine, és a tároló logban található felhasználók között.\nAz azonos felhasználó nevek összerendelése automatikusan megtörténik."
693 text_repository_usernames_mapping: "Állítsd be a felhasználó összerendeléseket a Redmine, és a tároló logban található felhasználók között.\nAz azonos felhasználó nevek összerendelése automatikusan megtörténik."
694 permission_edit_own_messages: Saját üzenetek szerkesztése
694 permission_edit_own_messages: Saját üzenetek szerkesztése
695 permission_delete_own_messages: Saját üzenetek törlése
695 permission_delete_own_messages: Saját üzenetek törlése
696 label_user_activity: "%s's activity"
@@ -692,3 +692,4 label_example: Esempio
692 text_repository_usernames_mapping: "Seleziona per aggiornare la corrispondenza tra gli utenti Redmine e quelli presenti nel log del repository.\nGli utenti Redmine e repository con lo stesso username o email sono mappati automaticamente."
692 text_repository_usernames_mapping: "Seleziona per aggiornare la corrispondenza tra gli utenti Redmine e quelli presenti nel log del repository.\nGli utenti Redmine e repository con lo stesso username o email sono mappati automaticamente."
693 permission_edit_own_messages: Modifica propri messaggi
693 permission_edit_own_messages: Modifica propri messaggi
694 permission_delete_own_messages: Elimina propri messaggi
694 permission_delete_own_messages: Elimina propri messaggi
695 label_user_activity: "%s's activity"
@@ -693,3 +693,4 label_example: Example
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
694 permission_edit_own_messages: Edit own messages
694 permission_edit_own_messages: Edit own messages
695 permission_delete_own_messages: Delete own messages
695 permission_delete_own_messages: Delete own messages
696 label_user_activity: "%s's activity"
@@ -692,3 +692,4 label_example: Example
692 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
692 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
693 permission_edit_own_messages: Edit own messages
693 permission_edit_own_messages: Edit own messages
694 permission_delete_own_messages: Delete own messages
694 permission_delete_own_messages: Delete own messages
695 label_user_activity: "%s's activity"
@@ -694,3 +694,4 label_example: Example
694 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
694 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
695 permission_edit_own_messages: Edit own messages
695 permission_edit_own_messages: Edit own messages
696 permission_delete_own_messages: Delete own messages
696 permission_delete_own_messages: Delete own messages
697 label_user_activity: "%s's activity"
@@ -694,3 +694,4 label_example: Example
694 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
694 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
695 permission_edit_own_messages: Edit own messages
695 permission_edit_own_messages: Edit own messages
696 permission_delete_own_messages: Delete own messages
696 permission_delete_own_messages: Delete own messages
697 label_user_activity: "%s's activity"
@@ -693,3 +693,4 label_example: Example
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
694 permission_edit_own_messages: Edit own messages
694 permission_edit_own_messages: Edit own messages
695 permission_delete_own_messages: Delete own messages
695 permission_delete_own_messages: Delete own messages
696 label_user_activity: "%s's activity"
@@ -711,3 +711,4 text_user_wrote: '%s napisał:'
711 text_wiki_destroy_confirmation: Jesteś pewien, że chcesz usunąć to wiki i całą jego zawartość ?
711 text_wiki_destroy_confirmation: Jesteś pewien, że chcesz usunąć to wiki i całą jego zawartość ?
712 text_workflow_edit: Zaznacz rolę i typ zagadnienia do edycji przepływu
712 text_workflow_edit: Zaznacz rolę i typ zagadnienia do edycji przepływu
713
713
714 label_user_activity: "%s's activity"
@@ -693,3 +693,4 label_example: Exemplo
693 text_repository_usernames_mapping: "Seleciona ou atualiza os usuários do Redmine mapeando para cada usuário encontrado no log do repositório.\nUsuários com o mesmo login ou email no Redmine e no repositório serão mapeados automaticamente."
693 text_repository_usernames_mapping: "Seleciona ou atualiza os usuários do Redmine mapeando para cada usuário encontrado no log do repositório.\nUsuários com o mesmo login ou email no Redmine e no repositório serão mapeados automaticamente."
694 permission_edit_own_messages: Editar próprias mensagens
694 permission_edit_own_messages: Editar próprias mensagens
695 permission_delete_own_messages: Excluir próprias mensagens
695 permission_delete_own_messages: Excluir próprias mensagens
696 label_user_activity: "%s's activity"
@@ -694,3 +694,4 label_example: Example
694 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
694 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
695 permission_edit_own_messages: Edit own messages
695 permission_edit_own_messages: Edit own messages
696 permission_delete_own_messages: Delete own messages
696 permission_delete_own_messages: Delete own messages
697 label_user_activity: "%s's activity"
@@ -692,3 +692,4 label_example: Example
692 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
692 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
693 permission_edit_own_messages: Edit own messages
693 permission_edit_own_messages: Edit own messages
694 permission_delete_own_messages: Delete own messages
694 permission_delete_own_messages: Delete own messages
695 label_user_activity: "%s's activity"
@@ -725,3 +725,4 text_user_mail_option: "Для невыбранных проектов, Вы б
725 text_user_wrote: '%s написал(а):'
725 text_user_wrote: '%s написал(а):'
726 text_wiki_destroy_confirmation: Вы уверены, что хотите удалить данную Wiki и все ее содержимое?
726 text_wiki_destroy_confirmation: Вы уверены, что хотите удалить данную Wiki и все ее содержимое?
727 text_workflow_edit: Выберите роль и трекер для редактирования последовательности состояний
727 text_workflow_edit: Выберите роль и трекер для редактирования последовательности состояний
728 label_user_activity: "%s's activity"
@@ -698,3 +698,4 label_example: Príklad
698 permission_edit_own_messages: Edit own messages
698 permission_edit_own_messages: Edit own messages
699 permission_delete_own_messages: Delete own messages
699 permission_delete_own_messages: Delete own messages
700 text_repository_usernames_mapping: "Select or update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
700 text_repository_usernames_mapping: "Select or update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
701 label_user_activity: "%s's activity"
@@ -693,3 +693,4 setting_gravatar_enabled: Use Gravatar user icons
693 permission_edit_own_messages: Edit own messages
693 permission_edit_own_messages: Edit own messages
694 permission_delete_own_messages: Delete own messages
694 permission_delete_own_messages: Delete own messages
695 text_repository_usernames_mapping: "Select or update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
695 text_repository_usernames_mapping: "Select or update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
696 label_user_activity: "%s's activity"
@@ -693,3 +693,4 label_example: Example
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
694 permission_edit_own_messages: Edit own messages
694 permission_edit_own_messages: Edit own messages
695 permission_delete_own_messages: Delete own messages
695 permission_delete_own_messages: Delete own messages
696 label_user_activity: "%s's activity"
@@ -695,3 +695,4 label_example: Example
695 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
695 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
696 permission_edit_own_messages: Edit own messages
696 permission_edit_own_messages: Edit own messages
697 permission_delete_own_messages: Delete own messages
697 permission_delete_own_messages: Delete own messages
698 label_user_activity: "%s's activity"
@@ -693,3 +693,4 label_example: Example
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
693 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
694 permission_edit_own_messages: Edit own messages
694 permission_edit_own_messages: Edit own messages
695 permission_delete_own_messages: Delete own messages
695 permission_delete_own_messages: Delete own messages
696 label_user_activity: "%s's activity"
@@ -694,3 +694,4 label_example: Example
694 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
694 text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
695 permission_edit_own_messages: Edit own messages
695 permission_edit_own_messages: Edit own messages
696 permission_delete_own_messages: Delete own messages
696 permission_delete_own_messages: Delete own messages
697 label_user_activity: "%s's activity"
@@ -695,3 +695,4 permission_delete_own_messages: Xóa bài viết cá nhân
695 label_example: Ví dụ
695 label_example: Ví dụ
696 text_repository_usernames_mapping: "Chọn hoặc cập nhật ánh xạ người dùng hệ thống với người dùng trong kho lưu trữ.\nNhững trường hợp trùng hợp về tên email sẽ được tự động ánh xạ."
696 text_repository_usernames_mapping: "Chọn hoặc cập nhật ánh xạ người dùng hệ thống với người dùng trong kho lưu trữ.\nNhững trường hợp trùng hợp về tên email sẽ được tự động ánh xạ."
697 permission_delete_own_messages: Delete own messages
697 permission_delete_own_messages: Delete own messages
698 label_user_activity: "%s's activity"
@@ -694,3 +694,4 default_activity_development: 開發
694 enumeration_issue_priorities: 項目優先權
694 enumeration_issue_priorities: 項目優先權
695 enumeration_doc_categories: 文件分類
695 enumeration_doc_categories: 文件分類
696 enumeration_activities: 活動 (時間追蹤)
696 enumeration_activities: 活動 (時間追蹤)
697 label_user_activity: "%s's activity"
@@ -695,3 +695,4 enumeration_issue_priorities: 问题优先级
695 enumeration_doc_categories: 文档类别
695 enumeration_doc_categories: 文档类别
696 enumeration_activities: 活动(时间跟踪)
696 enumeration_activities: 活动(时间跟踪)
697 permission_delete_own_messages: Delete own messages
697 permission_delete_own_messages: Delete own messages
698 label_user_activity: "%s's activity"
@@ -48,8 +48,16 module Redmine
48 end
48 end
49
49
50 # Sets the scope
50 # Sets the scope
51 # Argument can be :all, :default or an array of event types
51 def scope=(s)
52 def scope=(s)
52 @scope = s & event_types
53 case s
54 when :all
55 @scope = event_types
56 when :default
57 default_scope!
58 else
59 @scope = s & event_types
60 end
53 end
61 end
54
62
55 # Resets the scope to the default scope
63 # Resets the scope to the default scope
@@ -203,6 +203,24 class ProjectsControllerTest < Test::Unit::TestCase
203 }
203 }
204 end
204 end
205
205
206 def test_user_activity
207 get :activity, :user_id => 2
208 assert_response :success
209 assert_template 'activity'
210 assert_not_nil assigns(:events_by_day)
211
212 assert_tag :tag => "h3",
213 :content => /#{3.day.ago.to_date.day}/,
214 :sibling => { :tag => "dl",
215 :child => { :tag => "dt",
216 :attributes => { :class => /issue/ },
217 :child => { :tag => "a",
218 :content => /#{Issue.find(1).subject}/,
219 }
220 }
221 }
222 end
223
206 def test_activity_atom_feed
224 def test_activity_atom_feed
207 get :activity, :format => 'atom'
225 get :activity, :format => 'atom'
208 assert_response :success
226 assert_response :success
General Comments 0
You need to be logged in to leave comments. Login now