Mercurial > hg > soundsoftware-site
diff app/controllers/activities_controller.rb @ 511:107d36338b70 live
Merge from branch "cannam"
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2011 10:43:07 +0100 |
parents | 0c939c159af4 |
children | 066b55d7c053 433d4f72a19b |
line wrap: on
line diff
--- a/app/controllers/activities_controller.rb Thu Jun 09 16:51:06 2011 +0100 +++ b/app/controllers/activities_controller.rb Thu Jul 14 10:43:07 2011 +0100 @@ -1,11 +1,28 @@ +# Redmine - project management software +# Copyright (C) 2006-2011 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + class ActivitiesController < ApplicationController menu_item :activity before_filter :find_optional_project - accept_key_auth :index + accept_rss_auth :index def index @days = Setting.activity_days_default.to_i - + if params[:from] begin; @date_to = params[:from].to_date + 1; rescue; end end @@ -14,18 +31,18 @@ @date_from = @date_to - @days @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) - - @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, + + @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, :with_subprojects => @with_subprojects, :author => @author) @activity.scope_select {|t| !params["show_#{t}"].nil?} @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? events = @activity.events(@date_from, @date_to) - - if events.empty? || stale?(:etag => [events.first, User.current]) + + if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, User.current, current_language]) respond_to do |format| - format.html { + format.html { @events_by_day = events.group_by(&:event_date) render :layout => false if request.xhr? } @@ -40,7 +57,7 @@ } end end - + rescue ActiveRecord::RecordNotFound render_404 end @@ -55,5 +72,4 @@ rescue ActiveRecord::RecordNotFound render_404 end - end