Display the last 30 days on the activity view rather than the current month.
Number of days can be configured in the application settings. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1196 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
fbcdfee622
commit
bbe8ea29e8
@ -218,26 +218,15 @@ class ProjectsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def activity
|
def activity
|
||||||
if params[:year] and params[:year].to_i > 1900
|
@days = Setting.activity_days_default.to_i
|
||||||
@year = params[:year].to_i
|
|
||||||
if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
|
|
||||||
@month = params[:month].to_i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@year ||= Date.today.year
|
|
||||||
@month ||= Date.today.month
|
|
||||||
|
|
||||||
case params[:format]
|
if params[:from]
|
||||||
when 'atom'
|
begin; @date_to = params[:from].to_date; rescue; end
|
||||||
# 30 last days
|
|
||||||
@date_from = Date.today - 30
|
|
||||||
@date_to = Date.today + 1
|
|
||||||
else
|
|
||||||
# current month
|
|
||||||
@date_from = Date.civil(@year, @month, 1)
|
|
||||||
@date_to = @date_from >> 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@date_to ||= Date.today + 1
|
||||||
|
@date_from = @date_to - @days
|
||||||
|
|
||||||
@event_types = %w(issues news files documents changesets wiki_pages messages)
|
@event_types = %w(issues news files documents changesets wiki_pages messages)
|
||||||
@event_types.delete('wiki_pages') unless @project.wiki
|
@event_types.delete('wiki_pages') unless @project.wiki
|
||||||
@event_types.delete('changesets') unless @project.repository
|
@event_types.delete('changesets') unless @project.repository
|
||||||
|
@ -26,6 +26,10 @@ module ProjectsHelper
|
|||||||
}, options
|
}, options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def format_activity_day(date)
|
||||||
|
date == Date.today ? l(:label_today).titleize : format_date(date)
|
||||||
|
end
|
||||||
|
|
||||||
def format_activity_description(text)
|
def format_activity_description(text)
|
||||||
h(truncate(text, 250))
|
h(truncate(text, 250))
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<h2><%= "#{month_name(@month)} #{@year}" %></h2>
|
<h2><%= l(:label_activity) %></h2>
|
||||||
|
|
||||||
<div id="activity">
|
<div id="activity">
|
||||||
<% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %>
|
<% @events_by_day.keys.sort.reverse.each do |day| %>
|
||||||
<h3><%= day_name(day.cwday) %> <%= day.day %></h3>
|
<h3><%= format_activity_day(day) %></h3>
|
||||||
<dl>
|
<dl>
|
||||||
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
|
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
|
||||||
<dt class="<%= e.class.name.downcase %>"><span class="time"><%= format_time(e.event_datetime, false) %></span>
|
<dt class="<%= e.class.name.downcase %>"><span class="time"><%= format_time(e.event_datetime, false) %></span>
|
||||||
@ -19,14 +19,14 @@
|
|||||||
<%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %>
|
<%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %>
|
||||||
|
|
||||||
<div style="float:left;">
|
<div style="float:left;">
|
||||||
<% prev_params = params.clone.update :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) %>
|
<%= link_to_remote(('« ' + l(:label_previous)),
|
||||||
<%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")),
|
{:update => "content", :url => params.merge(:from => @date_to - @days), :complete => 'window.scrollTo(0,0)'},
|
||||||
{:update => "content", :url => prev_params}, {:href => url_for(prev_params)} %>
|
{:href => url_for(params.merge(:from => @date_to - @days))}) %>
|
||||||
</div>
|
</div>
|
||||||
<div style="float:right;">
|
<div style="float:right;">
|
||||||
<% next_params = params.clone.update :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) %>
|
<%= link_to_remote((l(:label_next) + ' »'),
|
||||||
<%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'),
|
{:update => "content", :url => params.merge(:from => @date_to + @days), :complete => 'window.scrollTo(0,0)'},
|
||||||
{:update => "content", :url => next_params}, {:href => url_for(next_params)} %>
|
{:href => url_for(params.merge(:from => @date_to + @days))}) unless @date_to >= Date.today %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="other-formats">
|
<p class="other-formats">
|
||||||
|
@ -29,6 +29,9 @@
|
|||||||
<p><label><%= l(:setting_per_page_options) %></label>
|
<p><label><%= l(:setting_per_page_options) %></label>
|
||||||
<%= text_field_tag 'settings[per_page_options]', Setting.per_page_options_array.join(', '), :size => 20 %><br /><em><%= l(:text_comma_separated) %></em></p>
|
<%= text_field_tag 'settings[per_page_options]', Setting.per_page_options_array.join(', '), :size => 20 %><br /><em><%= l(:text_comma_separated) %></em></p>
|
||||||
|
|
||||||
|
<p><label><%= l(:setting_activity_days_default) %></label>
|
||||||
|
<%= text_field_tag 'settings[activity_days_default]', Setting.activity_days_default, :size => 6 %> <%= l(:label_day_plural) %></p>
|
||||||
|
|
||||||
<p><label><%= l(:setting_host_name) %></label>
|
<p><label><%= l(:setting_host_name) %></label>
|
||||||
<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p>
|
<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p>
|
||||||
|
|
||||||
|
@ -37,6 +37,9 @@ attachment_max_size:
|
|||||||
issues_export_limit:
|
issues_export_limit:
|
||||||
format: int
|
format: int
|
||||||
default: 500
|
default: 500
|
||||||
|
activity_days_default:
|
||||||
|
format: int
|
||||||
|
default: 30
|
||||||
per_page_options:
|
per_page_options:
|
||||||
default: '25,50,100'
|
default: '25,50,100'
|
||||||
mail_from:
|
mail_from:
|
||||||
|
@ -607,3 +607,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -607,3 +607,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -608,3 +608,4 @@ default_activity_development: Entwicklung
|
|||||||
enumeration_issue_priorities: Ticket-Prioritäten
|
enumeration_issue_priorities: Ticket-Prioritäten
|
||||||
enumeration_doc_categories: Dokumentenkategorien
|
enumeration_doc_categories: Dokumentenkategorien
|
||||||
enumeration_activities: Aktivitäten (Zeiterfassung)
|
enumeration_activities: Aktivitäten (Zeiterfassung)
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -206,6 +206,7 @@ setting_emails_footer: Emails footer
|
|||||||
setting_protocol: Protocol
|
setting_protocol: Protocol
|
||||||
setting_per_page_options: Objects per page options
|
setting_per_page_options: Objects per page options
|
||||||
setting_user_format: Users display format
|
setting_user_format: Users display format
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
|
||||||
project_module_issue_tracking: Issue tracking
|
project_module_issue_tracking: Issue tracking
|
||||||
project_module_time_tracking: Time tracking
|
project_module_time_tracking: Time tracking
|
||||||
|
@ -610,3 +610,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -611,3 +611,4 @@ label_last_month: last month
|
|||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
label_on: 'on'
|
label_on: 'on'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -206,6 +206,7 @@ setting_emails_footer: Pied-de-page des emails
|
|||||||
setting_protocol: Protocole
|
setting_protocol: Protocole
|
||||||
setting_per_page_options: Options d'objets affichés par page
|
setting_per_page_options: Options d'objets affichés par page
|
||||||
setting_user_format: Format d'affichage des utilisateurs
|
setting_user_format: Format d'affichage des utilisateurs
|
||||||
|
setting_activity_days_default: Nombre de jours affichés sur l'activité des projets
|
||||||
|
|
||||||
project_module_issue_tracking: Suivi des demandes
|
project_module_issue_tracking: Suivi des demandes
|
||||||
project_module_time_tracking: Suivi du temps passé
|
project_module_time_tracking: Suivi du temps passé
|
||||||
|
@ -607,3 +607,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -607,3 +607,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -608,3 +608,4 @@ text_assign_time_entries_to_project: Assign reported hours to the project
|
|||||||
label_optional_description: Optional description
|
label_optional_description: Optional description
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -607,3 +607,4 @@ label_optional_description: Optional description
|
|||||||
label_last_month: last month
|
label_last_month: last month
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -608,3 +608,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -608,3 +608,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -607,3 +607,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -607,3 +607,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -607,3 +607,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -607,3 +607,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -611,3 +611,4 @@ error_issue_not_found_in_project: Задача не была найдена ил
|
|||||||
text_assign_time_entries_to_project: Прикрепить зарегистрированное время к проекту
|
text_assign_time_entries_to_project: Прикрепить зарегистрированное время к проекту
|
||||||
text_destroy_time_entries: Удалить зарегистрированное время
|
text_destroy_time_entries: Удалить зарегистрированное время
|
||||||
text_reassign_time_entries: 'Перенести зарегистрированное время на следующую задачу:'
|
text_reassign_time_entries: 'Перенести зарегистрированное время на следующую задачу:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -608,3 +608,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -608,3 +608,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -609,3 +609,4 @@ error_issue_not_found_in_project: 'The issue was not found or does not belong to
|
|||||||
text_assign_time_entries_to_project: Assign reported hours to the project
|
text_assign_time_entries_to_project: Assign reported hours to the project
|
||||||
text_destroy_time_entries: Delete reported hours
|
text_destroy_time_entries: Delete reported hours
|
||||||
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
text_reassign_time_entries: 'Reassign reported hours to this issue:'
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -608,3 +608,4 @@ default_activity_development: 開發
|
|||||||
enumeration_issue_priorities: 項目優先權
|
enumeration_issue_priorities: 項目優先權
|
||||||
enumeration_doc_categories: 文件分類
|
enumeration_doc_categories: 文件分類
|
||||||
enumeration_activities: 活動 (time tracking)
|
enumeration_activities: 活動 (time tracking)
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -608,3 +608,4 @@ default_activity_development: 开发
|
|||||||
enumeration_issue_priorities: 问题优先级
|
enumeration_issue_priorities: 问题优先级
|
||||||
enumeration_doc_categories: 文档类别
|
enumeration_doc_categories: 文档类别
|
||||||
enumeration_activities: 活动(时间跟踪)
|
enumeration_activities: 活动(时间跟踪)
|
||||||
|
setting_activity_days_default: Days displayed on project activity
|
||||||
|
@ -130,7 +130,7 @@ class ProjectsControllerTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_activity
|
def test_activity
|
||||||
get :activity, :id => 1, :year => 2.days.ago.to_date.year, :month => 2.days.ago.to_date.month
|
get :activity, :id => 1
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'activity'
|
assert_template 'activity'
|
||||||
assert_not_nil assigns(:events_by_day)
|
assert_not_nil assigns(:events_by_day)
|
||||||
@ -146,7 +146,7 @@ class ProjectsControllerTest < Test::Unit::TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get :activity, :id => 1, :year => 3.days.ago.to_date.year, :month => 3.days.ago.to_date.month
|
get :activity, :id => 1, :from => 3.days.ago.to_date
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'activity'
|
assert_template 'activity'
|
||||||
assert_not_nil assigns(:events_by_day)
|
assert_not_nil assigns(:events_by_day)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user