-
Notifications
You must be signed in to change notification settings - Fork 678
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git://github.com/edavis10/redmine
- Loading branch information
Showing
83 changed files
with
1,970 additions
and
828 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
class ActivitiesController < ApplicationController | ||
menu_item :activity | ||
before_filter :find_optional_project | ||
accept_key_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 | ||
|
||
@date_to ||= Date.today + 1 | ||
@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, | ||
: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]) | ||
respond_to do |format| | ||
format.html { | ||
@events_by_day = events.group_by(&:event_date) | ||
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 | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
class FilesController < ApplicationController | ||
menu_item :files | ||
|
||
before_filter :find_project | ||
before_filter :authorize | ||
|
||
helper :sort | ||
include SortHelper | ||
|
||
def index | ||
sort_init 'filename', 'asc' | ||
sort_update 'filename' => "#{Attachment.table_name}.filename", | ||
'created_on' => "#{Attachment.table_name}.created_on", | ||
'size' => "#{Attachment.table_name}.filesize", | ||
'downloads' => "#{Attachment.table_name}.downloads" | ||
|
||
@containers = [ Project.find(@project.id, :include => :attachments, :order => sort_clause)] | ||
@containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse | ||
render :layout => !request.xhr? | ||
end | ||
|
||
# TODO: split method into new (GET) and create (POST) | ||
def new | ||
if request.post? | ||
container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id])) | ||
attachments = Attachment.attach_files(container, params[:attachments]) | ||
render_attachment_warning_if_needed(container) | ||
|
||
if !attachments.empty? && Setting.notified_events.include?('file_added') | ||
Mailer.deliver_attachments_added(attachments[:files]) | ||
end | ||
redirect_to :controller => 'files', :action => 'index', :id => @project | ||
return | ||
end | ||
@versions = @project.versions.sort | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,8 @@ def show | |
end | ||
end | ||
|
||
def update | ||
show | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class ProjectEnumerationsController < ApplicationController | ||
before_filter :find_project | ||
before_filter :authorize | ||
|
||
def save | ||
if request.post? && params[:enumerations] | ||
Project.transaction do | ||
params[:enumerations].each do |id, activity| | ||
@project.update_or_create_time_entry_activity(id, activity) | ||
end | ||
end | ||
flash[:notice] = l(:notice_successful_update) | ||
end | ||
|
||
redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project | ||
end | ||
|
||
def destroy | ||
@project.time_entry_activities.each do |time_entry_activity| | ||
time_entry_activity.destroy(time_entry_activity.parent) | ||
end | ||
flash[:notice] = l(:notice_successful_update) | ||
redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project | ||
end | ||
|
||
end |
Oops, something went wrong.