Skip to content

Commit 4e8eda6

Browse files
committed
shorten long line of TimelogController
git-svn-id: http://svn.redmine.org/redmine/trunk@20116 e93f8b46-1217-0410-a6f0-8f06a7374b81
1 parent c4a95d5 commit 4e8eda6

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

app/controllers/timelog_controller.rb

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ def report
7979

8080
respond_to do |format|
8181
format.html { render :layout => !request.xhr? }
82-
format.csv { send_data(report_to_csv(@report), :type => 'text/csv; header=present', :filename => 'timelog.csv') }
82+
format.csv do
83+
send_data(report_to_csv(@report), :type => 'text/csv; header=present',
84+
:filename => 'timelog.csv')
85+
end
8386
end
8487
end
8588

@@ -92,19 +95,25 @@ def show
9295
end
9396

9497
def new
95-
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :author => User.current, :spent_on => User.current.today)
98+
@time_entry ||=
99+
TimeEntry.new(:project => @project, :issue => @issue,
100+
:author => User.current, :spent_on => User.current.today)
96101
@time_entry.safe_attributes = params[:time_entry]
97102
end
98103

99104
def create
100-
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :author => User.current, :user => User.current, :spent_on => User.current.today)
105+
@time_entry ||=
106+
TimeEntry.new(:project => @project, :issue => @issue,
107+
:author => User.current, :user => User.current,
108+
:spent_on => User.current.today)
101109
@time_entry.safe_attributes = params[:time_entry]
102110
if @time_entry.project && !User.current.allowed_to?(:log_time, @time_entry.project)
103111
render_403
104112
return
105113
end
106114

107-
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
115+
call_hook(:controller_timelog_edit_before_save,
116+
{:params => params, :time_entry => @time_entry})
108117

109118
if @time_entry.save
110119
respond_to do |format|
@@ -131,7 +140,9 @@ def create
131140
redirect_back_or_default project_time_entries_path(@time_entry.project)
132141
end
133142
}
134-
format.api { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) }
143+
format.api do
144+
render :action => 'show', :status => :created, :location => time_entry_url(@time_entry)
145+
end
135146
end
136147
else
137148
respond_to do |format|
@@ -147,7 +158,8 @@ def edit
147158

148159
def update
149160
@time_entry.safe_attributes = params[:time_entry]
150-
call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
161+
call_hook(:controller_timelog_edit_before_save,
162+
{:params => params, :time_entry => @time_entry})
151163

152164
if @time_entry.save
153165
respond_to do |format|
@@ -189,7 +201,10 @@ def bulk_update
189201
@time_entries.each do |time_entry|
190202
time_entry.reload
191203
time_entry.safe_attributes = attributes
192-
call_hook(:controller_time_entries_bulk_edit_before_save, { :params => params, :time_entry => time_entry })
204+
call_hook(
205+
:controller_time_entries_bulk_edit_before_save,
206+
{:params => params, :time_entry => time_entry}
207+
)
193208
if time_entry.save
194209
saved_time_entries << time_entry
195210
else

0 commit comments

Comments
 (0)