From 8154e6f72cc776c40255611133ebadf66f0f0c9c Mon Sep 17 00:00:00 2001 From: Chrisbr Date: Mon, 28 Apr 2014 21:42:09 +0200 Subject: [PATCH] Fixes Hound CI violations --- .../admin/callforpapers_controller.rb | 15 ++++++++++----- app/controllers/admin/emails_controller.rb | 5 +++-- app/controllers/admin/eventtype_controller.rb | 16 +++++++++------- app/controllers/admin/rooms_controller.rb | 10 ++++++---- app/controllers/admin/tracks_controller.rb | 14 ++++++++------ config/routes.rb | 16 ++++++++-------- 6 files changed, 44 insertions(+), 32 deletions(-) diff --git a/app/controllers/admin/callforpapers_controller.rb b/app/controllers/admin/callforpapers_controller.rb index b36b548c..3d8f8768 100644 --- a/app/controllers/admin/callforpapers_controller.rb +++ b/app/controllers/admin/callforpapers_controller.rb @@ -11,17 +11,22 @@ class Admin::CallforpapersController < ApplicationController def update @cfp = @conference.call_for_papers @cfp.update_attributes(params[:call_for_papers]) - redirect_to(admin_conference_callforpapers_path(:id => @conference.short_title), :notice => 'Call for Papers was successfully updated.') - + redirect_to(admin_conference_callforpapers_path( + id: @conference.short_title), + notice: 'Call for Papers was successfully updated.') end def create - @cfp = CallForPapers.new(params[:call_for_papers]) + @cfp = CallForPapers.new(params[:call_for_papers]) @conference.call_for_papers = @cfp if @cfp.save - redirect_to(admin_conference_callforpapers_path(:id => @conference.short_title), :notice => 'Call for Papers was successfully updated.') + redirect_to(admin_conference_callforpapers_path( + id: @conference.short_title), + notice: 'Call for Papers was successfully updated.') else - redirect_to(admin_conference_callforpapers_path(:id => @conference.short_title), :error => 'Call for Papers failed.') + redirect_to(admin_conference_callforpapers_path( + id: @conference.short_title), + error: 'Call for Papers failed.') end end end diff --git a/app/controllers/admin/emails_controller.rb b/app/controllers/admin/emails_controller.rb index 64b263f9..dbdfc44d 100644 --- a/app/controllers/admin/emails_controller.rb +++ b/app/controllers/admin/emails_controller.rb @@ -3,11 +3,12 @@ class Admin::EmailsController < ApplicationController def update @conference.email_settings.update_attributes(params[:email_settings]) - redirect_to(admin_conference_emails_path(@conference.short_title), :notice => 'Settings have been successfully updated.') + redirect_to(admin_conference_emails_path( + @conference.short_title), + notice: 'Settings have been successfully updated.') end def index @settings = @conference.email_settings end - end diff --git a/app/controllers/admin/eventtype_controller.rb b/app/controllers/admin/eventtype_controller.rb index 349a0408..125af325 100644 --- a/app/controllers/admin/eventtype_controller.rb +++ b/app/controllers/admin/eventtype_controller.rb @@ -6,11 +6,13 @@ class Admin::EventtypeController < ApplicationController end def update - begin - @conference.update_attributes!(params[:conference]) - redirect_to(admin_conference_eventtype_path(:conference_id => @conference.short_title), :notice => 'Event types were successfully updated.') - rescue Exception => e - redirect_to(admin_conference_eventtype_path(:conference_id => @conference.short_title), :alert => 'Event types update failed: #{e.message}') - end + @conference.update_attributes!(params[:conference]) + redirect_to(admin_conference_eventtype_path( + conference_id: @conference.short_title), + notice: 'Event types were successfully updated.') + rescue Exception => e + redirect_to(admin_conference_eventtype_path( + conference_id: @conference.short_title), + alert: 'Event types update failed: #{e.message}') end -end \ No newline at end of file +end diff --git a/app/controllers/admin/rooms_controller.rb b/app/controllers/admin/rooms_controller.rb index 7d05b04b..00342258 100644 --- a/app/controllers/admin/rooms_controller.rb +++ b/app/controllers/admin/rooms_controller.rb @@ -7,11 +7,13 @@ class Admin::RoomsController < ApplicationController def update if @conference.update_attributes(params[:conference]) - redirect_to(admin_conference_rooms_path(:conference_id => @conference.short_title), :notice => 'Rooms were successfully updated.') + redirect_to(admin_conference_rooms_path( + conference_id: @conference.short_title), + notice: 'Rooms were successfully updated.') else - redirect_to(admin_conference_rooms_path(:conference_id => @conference.short_title), :notice => 'Room update failed.') + redirect_to(admin_conference_rooms_path( + conference_id: @conference.short_title), + notice: 'Room update failed.') end - end - end diff --git a/app/controllers/admin/tracks_controller.rb b/app/controllers/admin/tracks_controller.rb index ea58759b..102cdd68 100644 --- a/app/controllers/admin/tracks_controller.rb +++ b/app/controllers/admin/tracks_controller.rb @@ -3,18 +3,20 @@ class Admin::TracksController < ApplicationController def show respond_to do |format| - format.html { render :tracks_list} - format.json { render :json => @conference.tracks.to_json } + format.html { render :tracks_list } + format.json { render json: @conference.tracks.to_json } end end def update if @conference.update_attributes(params[:conference]) - redirect_to(admin_conference_tracks_path(:conference_id => @conference.short_title), :notice => 'Tracks were successfully updated.') + redirect_to(admin_conference_tracks_path( + conference_id: @conference.short_title), + notice: 'Tracks were successfully updated.') else - redirect_to(admin_conference_tracks_path(:conference_id => @conference.short_title), :notice => 'Tracks update failed.') + redirect_to(admin_conference_tracks_path( + conference_id: @conference.short_title), + notice: 'Tracks update failed.') end - end - end diff --git a/config/routes.rb b/config/routes.rb index 7ab85652..e437fe45 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -24,14 +24,14 @@ Osem::Application.routes.draw do get "/volunteers" => "volunteers#index", :as => "volunteers_info" put "/volunteers" => "volunteers#update", :as => "volunteers_update" - resources :difficulty_levels, :only => [ :show, :update, :index ] - resources :rooms, :only => [ :show, :update, :index ] - resources :tracks, :only => [ :show, :update, :index ] - resources :eventtype, :only => [ :show, :update, :index ] - resources :social_events, :only => [ :show, :update, :index ] - resources :supporter_levels, :only => [ :show, :update, :index ] - resources :emails, :only => [ :show, :update, :index ] - resources :callforpapers, :only => [ :show, :update, :index ] + resources :difficulty_levels, only: [:show, :update, :index] + resources :rooms, only: [:show, :update, :index] + resources :tracks, only: [:show, :update, :index] + resources :eventtype, only: [:show, :update, :index] + resources :social_events, only: [:show, :update, :index] + resources :supporter_levels, only: [:show, :update, :index] + resources :emails, only: [:show, :update, :index] + resources :callforpapers, only: [:show, :update, :index] put "/questions/update_conference" => "questions#update_conference" resources :questions resources :events do