@@ -218,25 +218,14 class ProjectsController < ApplicationController | |||
|
218 | 218 | end |
|
219 | 219 | |
|
220 | 220 | def activity |
|
221 | if params[:year] and params[:year].to_i > 1900 | |
|
222 | @year = params[:year].to_i | |
|
223 | if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 | |
|
224 | @month = params[:month].to_i | |
|
225 | end | |
|
221 | @days = Setting.activity_days_default.to_i | |
|
222 | ||
|
223 | if params[:from] | |
|
224 | begin; @date_to = params[:from].to_date; rescue; end | |
|
226 | 225 | end |
|
227 | @year ||= Date.today.year | |
|
228 | @month ||= Date.today.month | |
|
229 | 226 | |
|
230 | case params[:format] | |
|
231 | when 'atom' | |
|
232 | # 30 last days | |
|
233 | @date_from = Date.today - 30 | |
|
234 | @date_to = Date.today + 1 | |
|
235 | else | |
|
236 | # current month | |
|
237 | @date_from = Date.civil(@year, @month, 1) | |
|
238 | @date_to = @date_from >> 1 | |
|
239 | end | |
|
227 | @date_to ||= Date.today + 1 | |
|
228 | @date_from = @date_to - @days | |
|
240 | 229 | |
|
241 | 230 | @event_types = %w(issues news files documents changesets wiki_pages messages) |
|
242 | 231 | @event_types.delete('wiki_pages') unless @project.wiki |
@@ -26,6 +26,10 module ProjectsHelper | |||
|
26 | 26 | }, options |
|
27 | 27 | end |
|
28 | 28 | |
|
29 | def format_activity_day(date) | |
|
30 | date == Date.today ? l(:label_today).titleize : format_date(date) | |
|
31 | end | |
|
32 | ||
|
29 | 33 | def format_activity_description(text) |
|
30 | 34 | h(truncate(text, 250)) |
|
31 | 35 | end |
@@ -1,8 +1,8 | |||
|
1 | <h2><%= "#{month_name(@month)} #{@year}" %></h2> | |
|
1 | <h2><%= l(:label_activity) %></h2> | |
|
2 | 2 | |
|
3 | 3 | <div id="activity"> |
|
4 |
<% @events_by_day.keys.sort |
|
|
5 | <h3><%= day_name(day.cwday) %> <%= day.day %></h3> | |
|
4 | <% @events_by_day.keys.sort.reverse.each do |day| %> | |
|
5 | <h3><%= format_activity_day(day) %></h3> | |
|
6 | 6 | <dl> |
|
7 | 7 | <% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%> |
|
8 | 8 | <dt class="<%= e.class.name.downcase %>"><span class="time"><%= format_time(e.event_datetime, false) %></span> |
@@ -19,14 +19,14 | |||
|
19 | 19 | <%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %> |
|
20 | 20 | |
|
21 | 21 | <div style="float:left;"> |
|
22 | <% prev_params = params.clone.update :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) %> | |
|
23 | <%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), | |
|
24 | {:update => "content", :url => prev_params}, {:href => url_for(prev_params)} %> | |
|
22 | <%= link_to_remote(('« ' + l(:label_previous)), | |
|
23 | {:update => "content", :url => params.merge(:from => @date_to - @days), :complete => 'window.scrollTo(0,0)'}, | |
|
24 | {:href => url_for(params.merge(:from => @date_to - @days))}) %> | |
|
25 | 25 | </div> |
|
26 | 26 | <div style="float:right;"> |
|
27 | <% next_params = params.clone.update :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) %> | |
|
28 | <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'), | |
|
29 | {:update => "content", :url => next_params}, {:href => url_for(next_params)} %> | |
|
27 | <%= link_to_remote((l(:label_next) + ' »'), | |
|
28 | {:update => "content", :url => params.merge(:from => @date_to + @days), :complete => 'window.scrollTo(0,0)'}, | |
|
29 | {:href => url_for(params.merge(:from => @date_to + @days))}) unless @date_to >= Date.today %> | |
|
30 | 30 | </div> |
|
31 | 31 | |
|
32 | 32 | <p class="other-formats"> |
@@ -29,6 +29,9 | |||
|
29 | 29 | <p><label><%= l(:setting_per_page_options) %></label> |
|
30 | 30 | <%= text_field_tag 'settings[per_page_options]', Setting.per_page_options_array.join(', '), :size => 20 %><br /><em><%= l(:text_comma_separated) %></em></p> |
|
31 | 31 | |
|
32 | <p><label><%= l(:setting_activity_days_default) %></label> | |
|
33 | <%= text_field_tag 'settings[activity_days_default]', Setting.activity_days_default, :size => 6 %> <%= l(:label_day_plural) %></p> | |
|
34 | ||
|
32 | 35 | <p><label><%= l(:setting_host_name) %></label> |
|
33 | 36 | <%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p> |
|
34 | 37 |
@@ -37,6 +37,9 attachment_max_size: | |||
|
37 | 37 | issues_export_limit: |
|
38 | 38 | format: int |
|
39 | 39 | default: 500 |
|
40 | activity_days_default: | |
|
41 | format: int | |
|
42 | default: 30 | |
|
40 | 43 | per_page_options: |
|
41 | 44 | default: '25,50,100' |
|
42 | 45 | mail_from: |
@@ -607,3 +607,4 error_issue_not_found_in_project: 'The issue was not found or does not belong to | |||
|
607 | 607 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
608 | 608 | text_destroy_time_entries: Delete reported hours |
|
609 | 609 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
610 | 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 | |||
|
607 | 607 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
608 | 608 | text_destroy_time_entries: Delete reported hours |
|
609 | 609 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
610 | setting_activity_days_default: Days displayed on project activity |
@@ -608,3 +608,4 default_activity_development: Entwicklung | |||
|
608 | 608 | enumeration_issue_priorities: Ticket-Prioritäten |
|
609 | 609 | enumeration_doc_categories: Dokumentenkategorien |
|
610 | 610 | enumeration_activities: Aktivitäten (Zeiterfassung) |
|
611 | setting_activity_days_default: Days displayed on project activity |
@@ -206,6 +206,7 setting_emails_footer: Emails footer | |||
|
206 | 206 | setting_protocol: Protocol |
|
207 | 207 | setting_per_page_options: Objects per page options |
|
208 | 208 | setting_user_format: Users display format |
|
209 | setting_activity_days_default: Days displayed on project activity | |
|
209 | 210 | |
|
210 | 211 | project_module_issue_tracking: Issue tracking |
|
211 | 212 | 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 | |||
|
610 | 610 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
611 | 611 | text_destroy_time_entries: Delete reported hours |
|
612 | 612 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
613 | setting_activity_days_default: Days displayed on project activity |
@@ -611,3 +611,4 label_last_month: last month | |||
|
611 | 611 | text_destroy_time_entries: Delete reported hours |
|
612 | 612 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
613 | 613 | label_on: 'on' |
|
614 | setting_activity_days_default: Days displayed on project activity |
@@ -206,6 +206,7 setting_emails_footer: Pied-de-page des emails | |||
|
206 | 206 | setting_protocol: Protocole |
|
207 | 207 | setting_per_page_options: Options d'objets affichés par page |
|
208 | 208 | setting_user_format: Format d'affichage des utilisateurs |
|
209 | setting_activity_days_default: Nombre de jours affichés sur l'activité des projets | |
|
209 | 210 | |
|
210 | 211 | project_module_issue_tracking: Suivi des demandes |
|
211 | 212 | 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 | |||
|
607 | 607 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
608 | 608 | text_destroy_time_entries: Delete reported hours |
|
609 | 609 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
610 | 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 | |||
|
607 | 607 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
608 | 608 | text_destroy_time_entries: Delete reported hours |
|
609 | 609 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
610 | 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 | |||
|
608 | 608 | label_optional_description: Optional description |
|
609 | 609 | text_destroy_time_entries: Delete reported hours |
|
610 | 610 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
611 | setting_activity_days_default: Days displayed on project activity |
@@ -607,3 +607,4 label_optional_description: Optional description | |||
|
607 | 607 | label_last_month: last month |
|
608 | 608 | text_destroy_time_entries: Delete reported hours |
|
609 | 609 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
610 | 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 | |||
|
608 | 608 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
609 | 609 | text_destroy_time_entries: Delete reported hours |
|
610 | 610 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
611 | 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 | |||
|
608 | 608 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
609 | 609 | text_destroy_time_entries: Delete reported hours |
|
610 | 610 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
611 | 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 | |||
|
607 | 607 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
608 | 608 | text_destroy_time_entries: Delete reported hours |
|
609 | 609 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
610 | 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 | |||
|
607 | 607 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
608 | 608 | text_destroy_time_entries: Delete reported hours |
|
609 | 609 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
610 | 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 | |||
|
607 | 607 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
608 | 608 | text_destroy_time_entries: Delete reported hours |
|
609 | 609 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
610 | 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 | |||
|
607 | 607 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
608 | 608 | text_destroy_time_entries: Delete reported hours |
|
609 | 609 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
610 | setting_activity_days_default: Days displayed on project activity |
@@ -611,3 +611,4 error_issue_not_found_in_project: Задача не была найдена ил | |||
|
611 | 611 | text_assign_time_entries_to_project: Прикрепить зарегистрированное время к проекту |
|
612 | 612 | text_destroy_time_entries: Удалить зарегистрированное время |
|
613 | 613 | text_reassign_time_entries: 'Перенести зарегистрированное время на следующую задачу:' |
|
614 | 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 | |||
|
608 | 608 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
609 | 609 | text_destroy_time_entries: Delete reported hours |
|
610 | 610 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
611 | 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 | |||
|
608 | 608 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
609 | 609 | text_destroy_time_entries: Delete reported hours |
|
610 | 610 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
611 | 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 | |||
|
609 | 609 | text_assign_time_entries_to_project: Assign reported hours to the project |
|
610 | 610 | text_destroy_time_entries: Delete reported hours |
|
611 | 611 | text_reassign_time_entries: 'Reassign reported hours to this issue:' |
|
612 | setting_activity_days_default: Days displayed on project activity |
@@ -608,3 +608,4 default_activity_development: 開發 | |||
|
608 | 608 | enumeration_issue_priorities: 項目優先權 |
|
609 | 609 | enumeration_doc_categories: 文件分類 |
|
610 | 610 | enumeration_activities: 活動 (time tracking) |
|
611 | setting_activity_days_default: Days displayed on project activity |
@@ -608,3 +608,4 default_activity_development: 开发 | |||
|
608 | 608 | enumeration_issue_priorities: 问题优先级 |
|
609 | 609 | enumeration_doc_categories: 文档类别 |
|
610 | 610 | enumeration_activities: 活动(时间跟踪) |
|
611 | setting_activity_days_default: Days displayed on project activity |
@@ -130,7 +130,7 class ProjectsControllerTest < Test::Unit::TestCase | |||
|
130 | 130 | end |
|
131 | 131 | |
|
132 | 132 | def test_activity |
|
133 | get :activity, :id => 1, :year => 2.days.ago.to_date.year, :month => 2.days.ago.to_date.month | |
|
133 | get :activity, :id => 1 | |
|
134 | 134 | assert_response :success |
|
135 | 135 | assert_template 'activity' |
|
136 | 136 | assert_not_nil assigns(:events_by_day) |
@@ -146,7 +146,7 class ProjectsControllerTest < Test::Unit::TestCase | |||
|
146 | 146 | } |
|
147 | 147 | } |
|
148 | 148 | |
|
149 |
get :activity, :id => 1, : |
|
|
149 | get :activity, :id => 1, :from => 3.days.ago.to_date | |
|
150 | 150 | assert_response :success |
|
151 | 151 | assert_template 'activity' |
|
152 | 152 | assert_not_nil assigns(:events_by_day) |
General Comments 0
You need to be logged in to leave comments.
Login now