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:
parent
fce4615f10
commit
6e777b7453
|
@ -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
|
||||
|
|
|
@ -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) -%>
|
||||
|
|
|
@ -692,3 +692,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -693,3 +693,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -697,3 +697,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -693,3 +693,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -694,3 +694,4 @@ default_activity_development: Entwicklung
|
|||
enumeration_issue_priorities: Ticket-Prioritäten
|
||||
enumeration_doc_categories: Dokumentenkategorien
|
||||
enumeration_activities: Aktivitäten (Zeiterfassung)
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -344,6 +344,7 @@ label_last_updates_plural: %d last updated
|
|||
label_registered_on: Registered on
|
||||
label_activity: Activity
|
||||
label_overall_activity: Overall activity
|
||||
label_user_activity: "%s's activity"
|
||||
label_new: New
|
||||
label_logged_as: Logged in as
|
||||
label_environment: Environment
|
||||
|
|
|
@ -677,3 +677,4 @@ text_user_mail_option: "En los proyectos no seleccionados, sólo recibirá notif
|
|||
text_user_wrote: '%s escribió:'
|
||||
text_wiki_destroy_confirmation: ¿Seguro que quiere borrar el wiki y todo su contenido?
|
||||
text_workflow_edit: Seleccionar un flujo de trabajo para actualizar
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -692,3 +692,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -170,7 +170,6 @@ field_start_page: Page de démarrage
|
|||
field_subproject: Sous-projet
|
||||
field_hours: Heures
|
||||
field_activity: Activité
|
||||
label_overall_activity: Activité globale
|
||||
field_spent_on: Date
|
||||
field_identifier: Identifiant
|
||||
field_is_filter: Utilisé comme filtre
|
||||
|
@ -344,6 +343,8 @@ label_last_updates: Dernière mise à jour
|
|||
label_last_updates_plural: %d dernières mises à jour
|
||||
label_registered_on: Inscrit le
|
||||
label_activity: Activité
|
||||
label_overall_activity: Activité globale
|
||||
label_user_activity: "Activité de %s"
|
||||
label_new: Nouveau
|
||||
label_logged_as: Connecté en tant que
|
||||
label_environment: Environnement
|
||||
|
|
|
@ -692,3 +692,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -693,3 +693,4 @@ label_example: Példa
|
|||
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."
|
||||
permission_edit_own_messages: Saját üzenetek szerkesztése
|
||||
permission_delete_own_messages: Saját üzenetek törlése
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -692,3 +692,4 @@ label_example: Esempio
|
|||
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."
|
||||
permission_edit_own_messages: Modifica propri messaggi
|
||||
permission_delete_own_messages: Elimina propri messaggi
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -693,3 +693,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -692,3 +692,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -694,3 +694,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -694,3 +694,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -693,3 +693,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -711,3 +711,4 @@ text_user_wrote: '%s napisał:'
|
|||
text_wiki_destroy_confirmation: Jesteś pewien, że chcesz usunąć to wiki i całą jego zawartość ?
|
||||
text_workflow_edit: Zaznacz rolę i typ zagadnienia do edycji przepływu
|
||||
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -693,3 +693,4 @@ label_example: Exemplo
|
|||
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."
|
||||
permission_edit_own_messages: Editar próprias mensagens
|
||||
permission_delete_own_messages: Excluir próprias mensagens
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -694,3 +694,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -692,3 +692,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -725,3 +725,4 @@ text_user_mail_option: "Для невыбранных проектов, Вы б
|
|||
text_user_wrote: '%s написал(а):'
|
||||
text_wiki_destroy_confirmation: Вы уверены, что хотите удалить данную Wiki и все ее содержимое?
|
||||
text_workflow_edit: Выберите роль и трекер для редактирования последовательности состояний
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -698,3 +698,4 @@ label_example: Príklad
|
|||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
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."
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -693,3 +693,4 @@ setting_gravatar_enabled: Use Gravatar user icons
|
|||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
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."
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -693,3 +693,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -695,3 +695,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -693,3 +693,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -694,3 +694,4 @@ label_example: Example
|
|||
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."
|
||||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -695,3 +695,4 @@ permission_delete_own_messages: Xóa bài viết cá nhân
|
|||
label_example: Ví dụ
|
||||
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 và email sẽ được tự động ánh xạ."
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -694,3 +694,4 @@ default_activity_development: 開發
|
|||
enumeration_issue_priorities: 項目優先權
|
||||
enumeration_doc_categories: 文件分類
|
||||
enumeration_activities: 活動 (時間追蹤)
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -695,3 +695,4 @@ enumeration_issue_priorities: 问题优先级
|
|||
enumeration_doc_categories: 文档类别
|
||||
enumeration_activities: 活动(时间跟踪)
|
||||
permission_delete_own_messages: Delete own messages
|
||||
label_user_activity: "%s's activity"
|
||||
|
|
|
@ -48,9 +48,17 @@ module Redmine
|
|||
end
|
||||
|
||||
# Sets the scope
|
||||
# Argument can be :all, :default or an array of event types
|
||||
def scope=(s)
|
||||
case s
|
||||
when :all
|
||||
@scope = event_types
|
||||
when :default
|
||||
default_scope!
|
||||
else
|
||||
@scope = s & event_types
|
||||
end
|
||||
end
|
||||
|
||||
# Resets the scope to the default scope
|
||||
def default_scope!
|
||||
|
|
|
@ -203,6 +203,24 @@ class ProjectsControllerTest < Test::Unit::TestCase
|
|||
}
|
||||
end
|
||||
|
||||
def test_user_activity
|
||||
get :activity, :user_id => 2
|
||||
assert_response :success
|
||||
assert_template 'activity'
|
||||
assert_not_nil assigns(:events_by_day)
|
||||
|
||||
assert_tag :tag => "h3",
|
||||
:content => /#{3.day.ago.to_date.day}/,
|
||||
:sibling => { :tag => "dl",
|
||||
:child => { :tag => "dt",
|
||||
:attributes => { :class => /issue/ },
|
||||
:child => { :tag => "a",
|
||||
:content => /#{Issue.find(1).subject}/,
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def test_activity_atom_feed
|
||||
get :activity, :format => 'atom'
|
||||
assert_response :success
|
||||
|
|
Loading…
Reference in New Issue