diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index bbb25d081..0107af3a0 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -47,27 +47,27 @@ class TimelogController < ApplicationController preload(:project, :user) respond_to do |format| - format.html { + format.html do @entry_count = scope.count @entry_pages = Paginator.new @entry_count, per_page_option, params['page'] @entries = scope.offset(@entry_pages.offset).limit(@entry_pages.per_page).to_a render :layout => !request.xhr? - } - format.api { + end + format.api do @entry_count = scope.count @offset, @limit = api_offset_and_limit @entries = scope.offset(@offset).limit(@limit).preload(:custom_values => :custom_field).to_a - } - format.atom { + end + format.atom do entries = scope.limit(Setting.feeds_limit.to_i).reorder("#{TimeEntry.table_name}.created_on DESC").to_a render_feed(entries, :title => l(:label_spent_time)) - } - format.csv { + end + format.csv do # Export all entries @entries = scope.to_a send_data(query_to_csv(@entries, @query, params), :type => 'text/csv; header=present', :filename => 'timelog.csv') - } + end end end @@ -117,7 +117,7 @@ class TimelogController < ApplicationController if @time_entry.save respond_to do |format| - format.html { + format.html do flash[:notice] = l(:notice_successful_create) if params[:continue] options = { @@ -139,7 +139,7 @@ class TimelogController < ApplicationController else redirect_back_or_default project_time_entries_path(@time_entry.project) end - } + end format.api do render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) end @@ -163,10 +163,10 @@ class TimelogController < ApplicationController if @time_entry.save respond_to do |format| - format.html { + format.html do flash[:notice] = l(:notice_successful_update) redirect_back_or_default project_time_entries_path(@time_entry.project) - } + end format.api { render_api_ok } end else @@ -237,21 +237,21 @@ class TimelogController < ApplicationController end respond_to do |format| - format.html { + format.html do if destroyed flash[:notice] = l(:notice_successful_delete) else flash[:error] = l(:notice_unable_delete_time_entry) end redirect_back_or_default project_time_entries_path(@projects.first), :referer => true - } - format.api { + end + format.api do if destroyed render_api_ok else render_validation_errors(@time_entries) end - } + end end end