From fa879dcb5eda6229e8767c2b7616e277d05a618f Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Tue, 11 Oct 2016 02:54:25 +0300 Subject: [PATCH] Fix exception handling in conferences controller --- app/assets/stylesheets/management/_forms.scss | 4 ++++ app/controllers/management/conferences_controller.rb | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/management/_forms.scss b/app/assets/stylesheets/management/_forms.scss index d82e975..b347ca3 100644 --- a/app/assets/stylesheets/management/_forms.scss +++ b/app/assets/stylesheets/management/_forms.scss @@ -28,3 +28,7 @@ select.date, select.datetime, select.time { @extend .col-sm-offset-3; } } + +.alert-error { + @extend .alert-danger; +} diff --git a/app/controllers/management/conferences_controller.rb b/app/controllers/management/conferences_controller.rb index c5ed982..8f15892 100644 --- a/app/controllers/management/conferences_controller.rb +++ b/app/controllers/management/conferences_controller.rb @@ -49,15 +49,15 @@ module Management begin if @conference.update_vote_data! - flash[:notice] = t '.vote_data_successfully_updated' + flash[:notice] = t('.vote_data_successfully_updated') else - flash[:alert] = t '.error_during_vote_data_save' + flash[:alert] = t('.error_during_vote_data_save') end + redirect_to :back rescue StandardError => e - flash[:alert] = t '.error_during_connection_with_voting_endpoint', error: e.message + flash[:alert] = t('.error_during_connection_with_voting_endpoint', error: e.message) + render :vote_results end - - redirect_to :back end def vote_results