##// END OF EJS Templates
remove trailing white space from test/fixtures/workflows.yml...
remove trailing white space from test/fixtures/workflows.yml git-svn-id: http://svn.redmine.org/redmine/trunk@16339 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r15273:ee82a55602a2
r15957:7816a4025a03 master
Show More
activities_controller.rb
90 lines | 3.1 KiB | text/x-ruby | RubyLexer
/ app / controllers / activities_controller.rb
Jean-Philippe Lang
Separation of RSS/API auth actions....
r6077 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
Separation of RSS/API auth actions....
r6077 #
# 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.
Eric Davis
Refactor: extract ProjectsController#activity to a new Activities controller....
r3933 class ActivitiesController < ApplicationController
menu_item :activity
Jean-Philippe Lang
Use .before_action instead of .before_filter....
r15273 before_action :find_optional_project
Jean-Philippe Lang
Separation of RSS/API auth actions....
r6077 accept_rss_auth :index
Eric Davis
Refactor: extract ProjectsController#activity to a new Activities controller....
r3933
def index
@days = Setting.activity_days_default.to_i
Toshi MARUYAMA
remove trailing white-spaces and an empty line from activities controller source....
r5715
Eric Davis
Refactor: extract ProjectsController#activity to a new Activities controller....
r3933 if params[:from]
begin; @date_to = params[:from].to_date + 1; rescue; end
end
Jean-Philippe Lang
Replace Date.today with User.current.today (#22320)....
r14997 @date_to ||= User.current.today + 1
Eric Davis
Refactor: extract ProjectsController#activity to a new Activities controller....
r3933 @date_from = @date_to - @days
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
Jean-Philippe Lang
Un-inline statement....
r13335 if params[:user_id].present?
@author = User.active.find(params[:user_id])
end
Toshi MARUYAMA
remove trailing white-spaces and an empty line from activities controller source....
r5715
@activity = Redmine::Activity::Fetcher.new(User.current, :project => @project,
Eric Davis
Refactor: extract ProjectsController#activity to a new Activities controller....
r3933 :with_subprojects => @with_subprojects,
:author => @author)
Jean-Philippe Lang
Activity page to remember user's selection of activities (#1605)....
r14296 pref = User.current.pref
Eric Davis
Refactor: extract ProjectsController#activity to a new Activities controller....
r3933 @activity.scope_select {|t| !params["show_#{t}"].nil?}
Jean-Philippe Lang
Activity page to remember user's selection of activities (#1605)....
r14296 if @activity.scope.present?
if params[:submit].present?
pref.activity_scope = @activity.scope
pref.save
end
else
if @author.nil?
scope = pref.activity_scope & @activity.event_types
@activity.scope = scope.present? ? scope : :default
else
@activity.scope = :all
end
end
Eric Davis
Refactor: extract ProjectsController#activity to a new Activities controller....
r3933
events = @activity.events(@date_from, @date_to)
Toshi MARUYAMA
remove trailing white-spaces and an empty line from activities controller source....
r5715
Jean-Philippe Lang
Force rendering of activity view if activity items count changed....
r9604 if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, events.size, User.current, current_language])
Eric Davis
Refactor: extract ProjectsController#activity to a new Activities controller....
r3933 respond_to do |format|
Toshi MARUYAMA
remove trailing white-spaces and an empty line from activities controller source....
r5715 format.html {
Jean-Philippe Lang
Fixed time zone issues introduced by r9719 (#10996)....
r9543 @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
Eric Davis
Refactor: extract ProjectsController#activity to a new Activities controller....
r3933 render :layout => false if request.xhr?
}
format.atom {
title = l(:label_activity)
if @author
title = @author.name
elsif @activity.scope.size == 1
title = l("label_#{@activity.scope.first.singularize}_plural")
end
render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
}
end
end
Toshi MARUYAMA
remove trailing white-spaces and an empty line from activities controller source....
r5715
Eric Davis
Refactor: extract ProjectsController#activity to a new Activities controller....
r3933 rescue ActiveRecord::RecordNotFound
render_404
end
private
# TODO: refactor, duplicated in projects_controller
def find_optional_project
return true unless params[:id]
@project = Project.find(params[:id])
authorize
rescue ActiveRecord::RecordNotFound
render_404
end
end