diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-10-03 15:36:59 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-10-03 15:36:59 +0000 |
commit | 4e8eda64d70db312e8a82110bb57f6c97c47539c (patch) | |
tree | 17da5a948e4dd7bae6dc0e6f80603ace2bfb6970 /app/controllers/timelog_controller.rb | |
parent | c4a95d5aeb17c898bbdf57c7e45a5a1210591127 (diff) | |
download | redmine-4e8eda64d70db312e8a82110bb57f6c97c47539c.tar.gz redmine-4e8eda64d70db312e8a82110bb57f6c97c47539c.zip |
shorten long line of TimelogController
git-svn-id: http://svn.redmine.org/redmine/trunk@20116 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/timelog_controller.rb')
-rw-r--r-- | app/controllers/timelog_controller.rb | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index 782ee5d14..b694137e8 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -79,7 +79,10 @@ class TimelogController < ApplicationController respond_to do |format| format.html { render :layout => !request.xhr? } - format.csv { send_data(report_to_csv(@report), :type => 'text/csv; header=present', :filename => 'timelog.csv') } + format.csv do + send_data(report_to_csv(@report), :type => 'text/csv; header=present', + :filename => 'timelog.csv') + end end end @@ -92,19 +95,25 @@ class TimelogController < ApplicationController end def new - @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :author => User.current, :spent_on => User.current.today) + @time_entry ||= + TimeEntry.new(:project => @project, :issue => @issue, + :author => User.current, :spent_on => User.current.today) @time_entry.safe_attributes = params[:time_entry] end def create - @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :author => User.current, :user => User.current, :spent_on => User.current.today) + @time_entry ||= + TimeEntry.new(:project => @project, :issue => @issue, + :author => User.current, :user => User.current, + :spent_on => User.current.today) @time_entry.safe_attributes = params[:time_entry] if @time_entry.project && !User.current.allowed_to?(:log_time, @time_entry.project) render_403 return end - call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) + call_hook(:controller_timelog_edit_before_save, + {:params => params, :time_entry => @time_entry}) if @time_entry.save respond_to do |format| @@ -131,7 +140,9 @@ class TimelogController < ApplicationController redirect_back_or_default project_time_entries_path(@time_entry.project) end } - format.api { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) } + format.api do + render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) + end end else respond_to do |format| @@ -147,7 +158,8 @@ class TimelogController < ApplicationController def update @time_entry.safe_attributes = params[:time_entry] - call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) + call_hook(:controller_timelog_edit_before_save, + {:params => params, :time_entry => @time_entry}) if @time_entry.save respond_to do |format| @@ -189,7 +201,10 @@ class TimelogController < ApplicationController @time_entries.each do |time_entry| time_entry.reload time_entry.safe_attributes = attributes - call_hook(:controller_time_entries_bulk_edit_before_save, { :params => params, :time_entry => time_entry }) + call_hook( + :controller_time_entries_bulk_edit_before_save, + {:params => params, :time_entry => time_entry} + ) if time_entry.save saved_time_entries << time_entry else |