From 1c1e56ed467237ebba8ad46e9414a67418bbd492 Mon Sep 17 00:00:00 2001 From: Nishanth Vijayan Date: Wed, 16 Mar 2016 11:20:56 +0530 Subject: [PATCH] Change update/save failures to use flash type :error instead of :alert --- app/controllers/admin/conference_controller.rb | 2 +- app/controllers/admin/events_controller.rb | 2 +- app/controllers/admin/questions_controller.rb | 2 +- app/controllers/admin/splashpages_controller.rb | 2 +- app/controllers/admin/users_controller.rb | 2 +- app/controllers/admin/venues_controller.rb | 2 +- app/controllers/admin/volunteers_controller.rb | 2 +- app/controllers/conference_registrations_controller.rb | 4 ++-- app/controllers/ticket_purchases_controller.rb | 4 ++-- spec/controllers/admin/conferences_controller_spec.rb | 4 ++-- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/controllers/admin/conference_controller.rb b/app/controllers/admin/conference_controller.rb index 9f5f41ad..9cdf0846 100644 --- a/app/controllers/admin/conference_controller.rb +++ b/app/controllers/admin/conference_controller.rb @@ -90,7 +90,7 @@ module Admin notice: 'Conference was successfully updated.' else redirect_to edit_admin_conference_path(id: short_title), - alert: 'Updating conference failed. ' \ + error: 'Updating conference failed. ' \ "#{@conference.errors.full_messages.join('. ')}." end end diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index db8c3760..2f5cbef6 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -183,7 +183,7 @@ module Admin @event = @conference.program.events.find(params[:id]) if !@event redirect_to admin_conference_program_events_path(conference_id: @conference.short_title), - alert: 'Error! Could not find event!' + error: 'Error! Could not find event!' return end @event diff --git a/app/controllers/admin/questions_controller.rb b/app/controllers/admin/questions_controller.rb index 9c826764..1a805a32 100644 --- a/app/controllers/admin/questions_controller.rb +++ b/app/controllers/admin/questions_controller.rb @@ -40,7 +40,7 @@ module Admin # GET questions/1/edit def edit if @question.global - redirect_to admin_conference_questions_path(conference_id: @conference.short_title), alert: 'Sorry, you cannot edit global questions. Create a new one.' + redirect_to admin_conference_questions_path(conference_id: @conference.short_title), error: 'Sorry, you cannot edit global questions. Create a new one.' end end diff --git a/app/controllers/admin/splashpages_controller.rb b/app/controllers/admin/splashpages_controller.rb index 9a0f26ff..2745cc8b 100644 --- a/app/controllers/admin/splashpages_controller.rb +++ b/app/controllers/admin/splashpages_controller.rb @@ -35,7 +35,7 @@ module Admin if @splashpage.destroy redirect_to admin_conference_splashpage_path, notice: 'Splashpage was successfully destroyed.' else - redirect_to admin_conference_splashpage_path, alert: 'An error prohibited this Splashpage from being destroyed: '\ + redirect_to admin_conference_splashpage_path, error: 'An error prohibited this Splashpage from being destroyed: '\ "#{@splashpage.errors.full_messages.join('. ')}." end end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index af74d3e6..dbd54ffd 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -30,7 +30,7 @@ module Admin if @user.update_attributes(user_params) redirect_to admin_users_path, notice: "Updated #{@user.name} (#{@user.email})!" + message else - redirect_to admin_users_path, alert: "Could not update #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}." + redirect_to admin_users_path, error: "Could not update #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}." end end diff --git a/app/controllers/admin/venues_controller.rb b/app/controllers/admin/venues_controller.rb index 2b151805..903357dc 100644 --- a/app/controllers/admin/venues_controller.rb +++ b/app/controllers/admin/venues_controller.rb @@ -36,7 +36,7 @@ module Admin if @venue.destroy redirect_to admin_conference_venue_path, notice: 'Venue was successfully deleted.' else - redirect_to admin_conference_venue_path, alert: 'An error prohibited this Venue from being destroyed: '\ + redirect_to admin_conference_venue_path, error: 'An error prohibited this Venue from being destroyed: '\ "#{@venue.errors.full_messages.join('. ')}." end end diff --git a/app/controllers/admin/volunteers_controller.rb b/app/controllers/admin/volunteers_controller.rb index bd5b85df..ec6d7ac7 100644 --- a/app/controllers/admin/volunteers_controller.rb +++ b/app/controllers/admin/volunteers_controller.rb @@ -26,7 +26,7 @@ module Admin if @conference.update_attributes(conference_params) redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: 'Volunteering options were successfully updated.' else - redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}" + redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), error: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}" end end diff --git a/app/controllers/conference_registrations_controller.rb b/app/controllers/conference_registrations_controller.rb index c3fb0f6d..95a699fb 100644 --- a/app/controllers/conference_registrations_controller.rb +++ b/app/controllers/conference_registrations_controller.rb @@ -21,7 +21,7 @@ class ConferenceRegistrationsController < ApplicationController end if @conference.registration_limit_exceeded? - redirect_to root_path, alert: "Sorry, registration limit exceeded for #{@conference.title}" + redirect_to root_path, error: "Sorry, registration limit exceeded for #{@conference.title}" return end @@ -102,7 +102,7 @@ class ConferenceRegistrationsController < ApplicationController @registration = Registration.find_by(conference: @conference, user: current_user) if !@registration redirect_to new_conference_conference_registrations_path(@conference.short_title), - alert: "Can't find a registration for #{@conference.title} for you. Please register." + error: "Can't find a registration for #{@conference.title} for you. Please register." end end diff --git a/app/controllers/ticket_purchases_controller.rb b/app/controllers/ticket_purchases_controller.rb index 395f09ce..d7c476ee 100644 --- a/app/controllers/ticket_purchases_controller.rb +++ b/app/controllers/ticket_purchases_controller.rb @@ -14,7 +14,7 @@ class TicketPurchasesController < ApplicationController end else redirect_to conference_conference_registrations_path(@conference.short_title), - alert: "Oops, something went wrong with your purchase! #{message}" + error: "Oops, something went wrong with your purchase! #{message}" end end @@ -25,7 +25,7 @@ class TicketPurchasesController < ApplicationController notice: 'Ticket successfully deleted.' else redirect_to conference_conference_registrations_path(@conference.short_title), - alert: 'An error prohibited deleting your purchase! '\ + error: 'An error prohibited deleting your purchase! '\ "#{@ticket_purchases.errors.full_messages.join('. ')}." end end diff --git a/spec/controllers/admin/conferences_controller_spec.rb b/spec/controllers/admin/conferences_controller_spec.rb index a1993924..9ad97cac 100644 --- a/spec/controllers/admin/conferences_controller_spec.rb +++ b/spec/controllers/admin/conferences_controller_spec.rb @@ -56,7 +56,7 @@ describe Admin::ConferenceController do short_title: nil) conference.reload - expect(flash[:alert]). + expect(flash[:error]). to eq("Updating conference failed. Short title can't be blank.") expect(conference.title).to eq('The dog and pony show') expect(conference.short_title).to eq("#{conference.short_title}") @@ -67,7 +67,7 @@ describe Admin::ConferenceController do attributes_for(:conference, title: 'Example Con', short_title: nil) - expect(flash[:alert]). + expect(flash[:error]). to eq("Updating conference failed. Short title can't be blank.") expect(response).to redirect_to edit_admin_conference_path( conference.short_title)