Mercurial > hg > soundsoftware-site
comparison app/controllers/.svn/text-base/activities_controller.rb.svn-base @ 441:cbce1fd3b1b7 redmine-1.2
Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:24:13 +0100 |
parents | 8661b858af72 |
children | 0c939c159af4 |
comparison
equal
deleted
inserted
replaced
245:051f544170fe | 441:cbce1fd3b1b7 |
---|---|
3 before_filter :find_optional_project | 3 before_filter :find_optional_project |
4 accept_key_auth :index | 4 accept_key_auth :index |
5 | 5 |
6 def index | 6 def index |
7 @days = Setting.activity_days_default.to_i | 7 @days = Setting.activity_days_default.to_i |
8 | 8 |
9 if params[:from] | 9 if params[:from] |
10 begin; @date_to = params[:from].to_date + 1; rescue; end | 10 begin; @date_to = params[:from].to_date + 1; rescue; end |
11 end | 11 end |
12 | 12 |
13 @date_to ||= Date.today + 1 | 13 @date_to ||= Date.today + 1 |
14 @date_from = @date_to - @days | 14 @date_from = @date_to - @days |
15 @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') | 15 @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') |
16 @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) | 16 @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) |
17 | 17 |
18 @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, | 18 @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, |
19 :with_subprojects => @with_subprojects, | 19 :with_subprojects => @with_subprojects, |
20 :author => @author) | 20 :author => @author) |
21 @activity.scope_select {|t| !params["show_#{t}"].nil?} | 21 @activity.scope_select {|t| !params["show_#{t}"].nil?} |
22 @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? | 22 @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? |
23 | 23 |
24 events = @activity.events(@date_from, @date_to) | 24 events = @activity.events(@date_from, @date_to) |
25 | 25 |
26 if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, User.current, current_language]) | 26 if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, User.current, current_language]) |
27 respond_to do |format| | 27 respond_to do |format| |
28 format.html { | 28 format.html { |
29 @events_by_day = events.group_by(&:event_date) | 29 @events_by_day = events.group_by(&:event_date) |
30 render :layout => false if request.xhr? | 30 render :layout => false if request.xhr? |
31 } | 31 } |
32 format.atom { | 32 format.atom { |
33 title = l(:label_activity) | 33 title = l(:label_activity) |
38 end | 38 end |
39 render_feed(events, :title => "#{@project || Setting.app_title}: #{title}") | 39 render_feed(events, :title => "#{@project || Setting.app_title}: #{title}") |
40 } | 40 } |
41 end | 41 end |
42 end | 42 end |
43 | 43 |
44 rescue ActiveRecord::RecordNotFound | 44 rescue ActiveRecord::RecordNotFound |
45 render_404 | 45 render_404 |
46 end | 46 end |
47 | 47 |
48 private | 48 private |
53 @project = Project.find(params[:id]) | 53 @project = Project.find(params[:id]) |
54 authorize | 54 authorize |
55 rescue ActiveRecord::RecordNotFound | 55 rescue ActiveRecord::RecordNotFound |
56 render_404 | 56 render_404 |
57 end | 57 end |
58 | |
59 end | 58 end |