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
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|
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|
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|
@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