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