summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/projects_controller.rb23
-rw-r--r--app/helpers/projects_helper.rb4
-rw-r--r--app/views/projects/activity.rhtml18
-rw-r--r--app/views/settings/_general.rhtml3
-rw-r--r--config/settings.yml3
-rw-r--r--lang/bg.yml1
-rw-r--r--lang/cs.yml1
-rw-r--r--lang/de.yml1
-rw-r--r--lang/en.yml1
-rw-r--r--lang/es.yml1
-rw-r--r--lang/fi.yml1
-rw-r--r--lang/fr.yml1
-rw-r--r--lang/he.yml1
-rw-r--r--lang/it.yml1
-rw-r--r--lang/ja.yml1
-rw-r--r--lang/ko.yml1
-rw-r--r--lang/lt.yml1
-rw-r--r--lang/nl.yml1
-rw-r--r--lang/pl.yml1
-rw-r--r--lang/pt-br.yml1
-rw-r--r--lang/pt.yml1
-rw-r--r--lang/ro.yml1
-rw-r--r--lang/ru.yml1
-rw-r--r--lang/sr.yml1
-rw-r--r--lang/sv.yml1
-rw-r--r--lang/uk.yml1
-rw-r--r--lang/zh-tw.yml1
-rw-r--r--lang/zh.yml1
-rw-r--r--test/functional/projects_controller_test.rb4
29 files changed, 50 insertions, 28 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index f9d6d0f0b..b9758c810 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -218,25 +218,14 @@ class ProjectsController < ApplicationController
end
def activity
- if params[:year] and params[:year].to_i > 1900
- @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
+ @days = Setting.activity_days_default.to_i
+
+ if params[:from]
+ begin; @date_to = params[:from].to_date; rescue; end
end
- @year ||= Date.today.year
- @month ||= Date.today.month
- case params[:format]
- when 'atom'
- # 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
+ @date_to ||= Date.today + 1
+ @date_from = @date_to - @days
@event_types = %w(issues news files documents changesets wiki_pages messages)
@event_types.delete('wiki_pages') unless @project.wiki
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index c07bbd2c2..a16377412 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -26,6 +26,10 @@ module ProjectsHelper
}, options
end
+ def format_activity_day(date)
+ date == Date.today ? l(:label_today).titleize : format_date(date)
+ end
+
def format_activity_description(text)
h(truncate(text, 250))
end
diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml
index aca08fd6f..95c8d485f 100644
--- a/app/views/projects/activity.rhtml
+++ b/app/views/projects/activity.rhtml
@@ -1,8 +1,8 @@
-<h2><%= "#{month_name(@month)} #{@year}" %></h2>
+<h2><%= l(:label_activity) %></h2>
<div id="activity">
-<% @events_by_day.keys.sort {|x,y| y <=> x }.each do |day| %>
-<h3><%= day_name(day.cwday) %> <%= day.day %></h3>
+<% @events_by_day.keys.sort.reverse.each do |day| %>
+<h3><%= format_activity_day(day) %></h3>
<dl>
<% @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>
@@ -19,14 +19,14 @@
<%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %>
<div style="float:left;">
-<% prev_params = params.clone.update :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) %>
-<%= link_to_remote ('&#171; ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")),
- {:update => "content", :url => prev_params}, {:href => url_for(prev_params)} %>
+<%= link_to_remote(('&#171; ' + l(:label_previous)),
+ {:update => "content", :url => params.merge(:from => @date_to - @days), :complete => 'window.scrollTo(0,0)'},
+ {:href => url_for(params.merge(:from => @date_to - @days))}) %>
</div>
<div style="float:right;">
-<% next_params = params.clone.update :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) %>
-<%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' &#187;'),
- {:update => "content", :url => next_params}, {:href => url_for(next_params)} %>
+<%= link_to_remote((l(:label_next) + ' &#187;'),
+ {:update => "content", :url => params.merge(:from => @date_to + @days), :complete => 'window.scrollTo(0,0)'},
+ {:href => url_for(params.merge(:from => @date_to + @days))}) unless @date_to >= Date.today %>
</div>
&nbsp;
<p class="other-formats">
diff --git a/app/views/settings/_general.rhtml b/app/views/settings/_general.rhtml
index 548ebbfac..bb56c43db 100644
--- a/app/views/settings/_general.rhtml
+++ b/app/views/settings/_general.rhtml
@@ -29,6 +29,9 @@
<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>
+<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>
<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p>
diff --git a/config/settings.yml b/config/settings.yml
index 590ebee6a..bb8c1f603 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -37,6 +37,9 @@ attachment_max_size:
issues_export_limit:
format: int
default: 500
+activity_days_default:
+ format: int
+ default: 30
per_page_options:
default: '25,50,100'
mail_from:
diff --git a/lang/bg.yml b/lang/bg.yml
index 12d5dfa5f..a99a8888a 100644
--- a/lang/bg.yml
+++ b/lang/bg.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/cs.yml b/lang/cs.yml
index 56b77d87b..5036b6b45 100644
--- a/lang/cs.yml
+++ b/lang/cs.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/de.yml b/lang/de.yml
index 6cde2d9d4..3d0db927c 100644
--- a/lang/de.yml
+++ b/lang/de.yml
@@ -608,3 +608,4 @@ default_activity_development: Entwicklung
enumeration_issue_priorities: Ticket-Prioritäten
enumeration_doc_categories: Dokumentenkategorien
enumeration_activities: Aktivitäten (Zeiterfassung)
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/en.yml b/lang/en.yml
index a5da5a855..a23d1b025 100644
--- a/lang/en.yml
+++ b/lang/en.yml
@@ -206,6 +206,7 @@ setting_emails_footer: Emails footer
setting_protocol: Protocol
setting_per_page_options: Objects per page options
setting_user_format: Users display format
+setting_activity_days_default: Days displayed on project activity
project_module_issue_tracking: Issue tracking
project_module_time_tracking: Time tracking
diff --git a/lang/es.yml b/lang/es.yml
index 9032d3599..66238934d 100644
--- a/lang/es.yml
+++ b/lang/es.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/fi.yml b/lang/fi.yml
index a0f165e56..d85629e1f 100644
--- a/lang/fi.yml
+++ b/lang/fi.yml
@@ -611,3 +611,4 @@ label_last_month: last month
text_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
label_on: 'on'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/fr.yml b/lang/fr.yml
index 30c9f6cca..85e699c3c 100644
--- a/lang/fr.yml
+++ b/lang/fr.yml
@@ -206,6 +206,7 @@ setting_emails_footer: Pied-de-page des emails
setting_protocol: Protocole
setting_per_page_options: Options d'objets affichés par page
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_time_tracking: Suivi du temps passé
diff --git a/lang/he.yml b/lang/he.yml
index a43f1c022..fe31e860b 100644
--- a/lang/he.yml
+++ b/lang/he.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/it.yml b/lang/it.yml
index 80ffc5f6c..f207c2e19 100644
--- a/lang/it.yml
+++ b/lang/it.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/ja.yml b/lang/ja.yml
index 1c25b1a3f..f00fc4d81 100644
--- a/lang/ja.yml
+++ b/lang/ja.yml
@@ -608,3 +608,4 @@ text_assign_time_entries_to_project: Assign reported hours to the project
label_optional_description: Optional description
text_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/ko.yml b/lang/ko.yml
index 267560a6d..cf25e23ef 100644
--- a/lang/ko.yml
+++ b/lang/ko.yml
@@ -607,3 +607,4 @@ label_optional_description: Optional description
label_last_month: last month
text_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/lt.yml b/lang/lt.yml
index 5d26c7ea9..b50120764 100644
--- a/lang/lt.yml
+++ b/lang/lt.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/nl.yml b/lang/nl.yml
index 12563f2e4..2d8a6aa00 100644
--- a/lang/nl.yml
+++ b/lang/nl.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/pl.yml b/lang/pl.yml
index 575c8262a..57559aedb 100644
--- a/lang/pl.yml
+++ b/lang/pl.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/pt-br.yml b/lang/pt-br.yml
index d128617da..35f490b83 100644
--- a/lang/pt-br.yml
+++ b/lang/pt-br.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/pt.yml b/lang/pt.yml
index 33b76892b..c07364f72 100644
--- a/lang/pt.yml
+++ b/lang/pt.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/ro.yml b/lang/ro.yml
index b8b737e42..68de767a9 100644
--- a/lang/ro.yml
+++ b/lang/ro.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/ru.yml b/lang/ru.yml
index a92105ca4..39a30fd3b 100644
--- a/lang/ru.yml
+++ b/lang/ru.yml
@@ -611,3 +611,4 @@ error_issue_not_found_in_project: Задача не была найдена ил
text_assign_time_entries_to_project: Прикрепить зарегистрированное время к проекту
text_destroy_time_entries: Удалить зарегистрированное время
text_reassign_time_entries: 'Перенести зарегистрированное время на следующую задачу:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/sr.yml b/lang/sr.yml
index 16e870b76..5e693c09e 100644
--- a/lang/sr.yml
+++ b/lang/sr.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/sv.yml b/lang/sv.yml
index 3375a6850..1b4698f35 100644
--- a/lang/sv.yml
+++ b/lang/sv.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/uk.yml b/lang/uk.yml
index 2fd3589f5..c26454189 100644
--- a/lang/uk.yml
+++ b/lang/uk.yml
@@ -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_destroy_time_entries: Delete reported hours
text_reassign_time_entries: 'Reassign reported hours to this issue:'
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/zh-tw.yml b/lang/zh-tw.yml
index 58088d84f..5d5040811 100644
--- a/lang/zh-tw.yml
+++ b/lang/zh-tw.yml
@@ -608,3 +608,4 @@ default_activity_development: 開發
enumeration_issue_priorities: 項目優先權
enumeration_doc_categories: 文件分類
enumeration_activities: 活動 (time tracking)
+setting_activity_days_default: Days displayed on project activity
diff --git a/lang/zh.yml b/lang/zh.yml
index 3d88c8565..8646d47cd 100644
--- a/lang/zh.yml
+++ b/lang/zh.yml
@@ -608,3 +608,4 @@ default_activity_development: 开发
enumeration_issue_priorities: 问题优先级
enumeration_doc_categories: 文档类别
enumeration_activities: 活动(时间跟踪)
+setting_activity_days_default: Days displayed on project activity
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index 92ac6f09a..f610469df 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -130,7 +130,7 @@ class ProjectsControllerTest < Test::Unit::TestCase
end
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_template 'activity'
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_template 'activity'
assert_not_nil assigns(:events_by_day)