From bbe8ea29e8d3e6de60b96c08d60de9447bcceca9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 5 Mar 2008 13:44:08 +0000 Subject: 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 --- app/controllers/projects_controller.rb | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'app/controllers') 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 -- cgit v1.2.3