summaryrefslogtreecommitdiffstats
path: root/app/controllers/timelog_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-21 14:26:51 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-21 14:26:51 +0000
commit41eab6615b31185831b110b5e3d29dc08cefceca (patch)
tree1d4e9b3ab4c4eb36052e1d6d8cf6a6953d19c772 /app/controllers/timelog_controller.rb
parent94b621a99fd57462a6dd641044f62b7ecb67ccc2 (diff)
downloadredmine-41eab6615b31185831b110b5e3d29dc08cefceca.tar.gz
redmine-41eab6615b31185831b110b5e3d29dc08cefceca.zip
Enable global time logging at /time_entries/new (#10020).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8691 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/timelog_controller.rb')
-rw-r--r--app/controllers/timelog_controller.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index e1895f5de..ee15a6c8a 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -17,11 +17,15 @@
class TimelogController < ApplicationController
menu_item :issues
- before_filter :find_project, :only => [:new, :create]
+
+ before_filter :find_project, :only => [:create]
before_filter :find_time_entry, :only => [:show, :edit, :update]
before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy]
- before_filter :authorize, :except => [:index, :report]
- before_filter :find_optional_project, :only => [:index, :report]
+ before_filter :authorize, :except => [:new, :index, :report]
+
+ before_filter :find_optional_project, :only => [:new, :index, :report]
+ before_filter :authorize_global, :only => [:new, :index, :report]
+
accept_rss_auth :index
accept_api_auth :index, :show, :create, :update, :destroy
@@ -129,7 +133,11 @@ class TimelogController < ApplicationController
format.html {
flash[:notice] = l(:notice_successful_create)
if params[:continue]
- redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue
+ if params[:project_id]
+ redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue
+ else
+ redirect_to :action => 'new'
+ end
else
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
end
@@ -138,7 +146,7 @@ class TimelogController < ApplicationController
end
else
respond_to do |format|
- format.html { render :action => 'edit' }
+ format.html { render :action => 'new' }
format.api { render_validation_errors(@time_entry) }
end
end
@@ -274,7 +282,6 @@ private
elsif !params[:project_id].blank?
@project = Project.find(params[:project_id])
end
- deny_access unless User.current.allowed_to?(:view_time_entries, @project, :global => true)
end
# Retrieves the date range based on predefined ranges or specific from/to param dates