diff --git a/app/controllers/admin/call_for_papers_controller.rb b/app/controllers/admin/call_for_papers_controller.rb index 4e4e3e13..58e0efc6 100644 --- a/app/controllers/admin/call_for_papers_controller.rb +++ b/app/controllers/admin/call_for_papers_controller.rb @@ -18,7 +18,7 @@ module Admin redirect_to admin_conference_call_for_paper_path, notice: 'Call for papers successfully created.' else - flash[:alert] = "Creating the call for papers failed. #{@call_for_paper.errors.full_messages.join('. ')}." + flash[:error] = "Creating the call for papers failed. #{@call_for_paper.errors.full_messages.join('. ')}." render :new end end @@ -37,7 +37,7 @@ module Admin redirect_to(admin_conference_call_for_paper_path(@conference.short_title), notice: 'Call for papers successfully updated.') else - flash[:alert] = "Updating call for papers failed. #{@cfp.errors.to_a.join('. ')}." + flash[:error] = "Updating call for papers failed. #{@cfp.errors.to_a.join('. ')}." render :new end end @@ -46,7 +46,7 @@ module Admin if @call_for_paper.destroy redirect_to admin_conference_call_for_paper_path, notice: 'Call for Papers was successfully deleted.' else - redirect_to admin_conference_call_for_paper_path, alert: 'A error prohibited this Call for Papers from being destroyed: '\ + redirect_to admin_conference_call_for_paper_path, error: 'An error prohibited this Call for Papers from being destroyed: '\ "#{@call_for_paper.errors.full_messages.join('. ')}." end end diff --git a/app/controllers/admin/campaigns_controller.rb b/app/controllers/admin/campaigns_controller.rb index 8a0e3e23..de09a520 100644 --- a/app/controllers/admin/campaigns_controller.rb +++ b/app/controllers/admin/campaigns_controller.rb @@ -15,9 +15,8 @@ module Admin redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title), notice: 'Campaign successfully created.') else - redirect_to(new_admin_conference_campaign_path(conference_id: @conference.short_title), - alert: "Creating of Campaign for #{@conference.short_title} failed." \ - "#{@campaign.errors.full_messages.join('. ')}.") + flash[:error] = 'Campaign creation failed. ' + @campaign.errors.full_messages.to_sentence + render action: 'new' end end @@ -31,11 +30,8 @@ module Admin conference_id: @conference.short_title), notice: "Campaign '#{@campaign.name}' successfully updated.") else - redirect_to(edit_admin_conference_campaign_path( - conference_id: @conference.short_title, - id: @campaign.id), - alert: "Update of Campaign for #{@conference.short_title} failed." \ - "#{@campaign.errors.full_messages.join('. ')}.") + flash[:error] = 'Campaign update failed. ' + @campaign.errors.full_messages.to_sentence + render action: 'edit' end end diff --git a/app/controllers/admin/commercials_controller.rb b/app/controllers/admin/commercials_controller.rb index b5deddcb..59bfd459 100644 --- a/app/controllers/admin/commercials_controller.rb +++ b/app/controllers/admin/commercials_controller.rb @@ -22,7 +22,7 @@ module Admin redirect_to admin_conference_commercials_path, notice: 'Commercial was successfully created.' else - flash[:alert] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}." + flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}." render :new end end @@ -32,7 +32,7 @@ module Admin redirect_to admin_conference_commercials_path, notice: 'Commercial was successfully updated.' else - flash[:alert] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}." + flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}." render :edit end end diff --git a/app/controllers/admin/registration_periods_controller.rb b/app/controllers/admin/registration_periods_controller.rb index 05cdf705..935cc443 100644 --- a/app/controllers/admin/registration_periods_controller.rb +++ b/app/controllers/admin/registration_periods_controller.rb @@ -16,7 +16,7 @@ module Admin redirect_to admin_conference_registration_period_path(@conference.short_title), notice: 'Registration Period successfully updated.' else - flash[:alert] = "A error prohibited the Registration Period from being saved: #{@registration_period.errors.full_messages.join('. ')}." + flash[:error] = "An error prohibited the Registration Period from being saved: #{@registration_period.errors.full_messages.join('. ')}." render :new end end @@ -36,7 +36,7 @@ module Admin redirect_to admin_conference_registration_period_path(@conference.short_title), notice: 'Registration Period successfully updated.' else - flash[:alert] = 'A error prohibited the Registration Period from being saved: ' \ + flash[:error] = 'An error prohibited the Registration Period from being saved: ' \ "#{@registration_period.errors.full_messages.join('. ')}." render :edit end diff --git a/app/controllers/admin/registrations_controller.rb b/app/controllers/admin/registrations_controller.rb index 2d516cd4..d92f6f3d 100644 --- a/app/controllers/admin/registrations_controller.rb +++ b/app/controllers/admin/registrations_controller.rb @@ -19,7 +19,7 @@ module Admin redirect_to admin_conference_registrations_path(@conference.short_title), notice: 'Successfully updated registration!' else - flash[:alert] = "A error prohibited the Registration for #{@conference.title}: "\ + flash[:error] = "An error prohibited the Registration for #{@conference.title}: "\ "#{@registration.errors.full_messages.join('. ')}." render :edit end @@ -32,7 +32,7 @@ module Admin notice: "Deleted registration for #{@user.name}!" else redirect_to(admin_conference_registrations_path(@conference.short_title), - alert: 'You must be an admin to delete a registration.') + error: 'You must be an admin to delete a registration.') end end diff --git a/app/controllers/admin/splashpages_controller.rb b/app/controllers/admin/splashpages_controller.rb index fe06ae2c..7359cf60 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: 'A error prohibited this Splashpage from being destroyed: '\ + redirect_to admin_conference_splashpage_path, alert: 'An error prohibited this Splashpage from being destroyed: '\ "#{@splashpage.errors.full_messages.join('. ')}." end end diff --git a/app/controllers/admin/targets_controller.rb b/app/controllers/admin/targets_controller.rb index b069cb76..b0e11520 100644 --- a/app/controllers/admin/targets_controller.rb +++ b/app/controllers/admin/targets_controller.rb @@ -17,7 +17,7 @@ module Admin redirect_to(admin_conference_targets_path(conference_id: @conference.short_title), notice: 'Target successfully created.') else - flash[:alert] = "Creating target failed: #{@target.errors.full_messages.join('. ')}." + flash[:error] = "Creating target failed: #{@target.errors.full_messages.join('. ')}." render :new end end @@ -29,7 +29,7 @@ module Admin redirect_to(admin_conference_targets_path(conference_id: @conference.short_title), notice: 'Target successfully updated.') else - flash[:alert] = "Target update failed: #{@target.errors.full_messages.join('. ')}." + flash[:error] = "Target update failed: #{@target.errors.full_messages.join('. ')}." render :edit end end @@ -40,7 +40,7 @@ module Admin notice: 'Target successfully destroyed.') else redirect_to(admin_conference_targets_path(conference_id: @conference.short_title), - alert: 'Target was successfully destroyed.' \ + error: 'Target was successfully destroyed.' \ "#{@target.errors.full_messages.join('. ')}.") end end diff --git a/app/controllers/admin/tickets_controller.rb b/app/controllers/admin/tickets_controller.rb index 5920b759..de27459a 100644 --- a/app/controllers/admin/tickets_controller.rb +++ b/app/controllers/admin/tickets_controller.rb @@ -17,7 +17,7 @@ module Admin redirect_to(admin_conference_tickets_path(conference_id: @conference.short_title), notice: 'Ticket successfully created.') else - flash[:alert] = "Creating Ticket failed: #{@ticket.errors.full_messages.join('. ')}." + flash[:error] = "Creating Ticket failed: #{@ticket.errors.full_messages.join('. ')}." render :new end end @@ -29,7 +29,7 @@ module Admin redirect_to(admin_conference_tickets_path(conference_id: @conference.short_title), notice: 'Ticket successfully updated.') else - flash[:alert] = "Ticket update failed: #{@ticket.errors.full_messages.join('. ')}." + flash[:error] = "Ticket update failed: #{@ticket.errors.full_messages.join('. ')}." render :edit end end @@ -40,7 +40,7 @@ module Admin notice: 'Ticket successfully destroyed.') else redirect_to(admin_conference_tickets_path(conference_id: @conference.short_title), - alert: 'Ticket was successfully destroyed.' \ + error: 'Ticket was successfully destroyed.' \ "#{@ticket.errors.full_messages.join('. ')}.") end end diff --git a/app/controllers/admin/tracks_controller.rb b/app/controllers/admin/tracks_controller.rb index 797d92cc..13d6870f 100644 --- a/app/controllers/admin/tracks_controller.rb +++ b/app/controllers/admin/tracks_controller.rb @@ -22,7 +22,7 @@ module Admin redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title), notice: 'Track successfully created.') else - flash[:alert] = "Creating Track failed: #{@track.errors.full_messages.join('. ')}." + flash[:error] = "Creating Track failed: #{@track.errors.full_messages.join('. ')}." render :new end end @@ -34,7 +34,7 @@ module Admin redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title), notice: 'Track successfully updated.') else - flash[:alert] = "Track update failed: #{@track.errors.full_messages.join('. ')}." + flash[:error] = "Track update failed: #{@track.errors.full_messages.join('. ')}." render :edit end end @@ -45,7 +45,7 @@ module Admin notice: 'Track successfully deleted.') else redirect_to(admin_conference_tracks_path(conference_id: @conference.short_title), - alert: 'Track couldn\'t be deleted.' \ + error: 'Track couldn\'t be deleted.' \ "#{@track.errors.full_messages.join('. ')}.") end end diff --git a/app/controllers/admin/venues_controller.rb b/app/controllers/admin/venues_controller.rb index 9bb8e9b0..98ccd708 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: 'A error prohibited this Venue from being destroyed: '\ + redirect_to admin_conference_venue_path, alert: 'An error prohibited this Venue from being destroyed: '\ "#{@venue.errors.full_messages.join('. ')}." end end diff --git a/app/controllers/commercials_controller.rb b/app/controllers/commercials_controller.rb index d107cb9c..e9c886e8 100644 --- a/app/controllers/commercials_controller.rb +++ b/app/controllers/commercials_controller.rb @@ -18,7 +18,7 @@ class CommercialsController < ApplicationController redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id), notice: 'Commercial was successfully created.' else - flash[:alert] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}." + flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}." render :new end end @@ -28,7 +28,7 @@ class CommercialsController < ApplicationController redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id), notice: 'Commercial was successfully updated.' else - flash[:alert] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}." + flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}." render :edit end end diff --git a/app/controllers/conference_registrations_controller.rb b/app/controllers/conference_registrations_controller.rb index 52331eab..20460016 100644 --- a/app/controllers/conference_registrations_controller.rb +++ b/app/controllers/conference_registrations_controller.rb @@ -34,7 +34,7 @@ class ConferenceRegistrationsController < ApplicationController notice: 'You are now registered and will be receiving E-Mail notifications.' end else - flash[:alert] = "A error prohibited the registration for #{@conference.title}: "\ + flash[:error] = "An error prohibited the registration for #{@conference.title}: "\ "#{@registration.errors.full_messages.join('. ')}." render :new end @@ -45,7 +45,7 @@ class ConferenceRegistrationsController < ApplicationController redirect_to conference_conference_registrations_path(@conference.short_title), notice: 'Registration was successfully updated.' else - flash[:alert] = "A error prohibited the registration for #{@conference.title}: "\ + flash[:error] = "An error prohibited the registration for #{@conference.title}: "\ "#{@registration.errors.full_messages.join('. ')}." render :edit end @@ -57,7 +57,7 @@ class ConferenceRegistrationsController < ApplicationController notice: "You are not registered for #{@conference.title} anymore!" else redirect_to root_path, - alert: "A error prohibited deleting the registration for #{@conference.title}: "\ + error: "An error prohibited deleting the registration for #{@conference.title}: "\ "#{@registration.errors.full_messages.join('. ')}." end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3975c9d4..41041d8e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -16,7 +16,7 @@ class UsersController < ApplicationController if @user.update(user_params) redirect_to @user, notice: 'User was successfully updated.' else - flash[:error] = "A error prohibited your Profile from being saved: #{@user.errors.full_messages.join('. ')}." + flash[:error] = "An error prohibited your Profile from being saved: #{@user.errors.full_messages.join('. ')}." render :edit end end diff --git a/app/models/track.rb b/app/models/track.rb index 7a992246..5cdb2bb3 100644 --- a/app/models/track.rb +++ b/app/models/track.rb @@ -5,6 +5,8 @@ class Track < ActiveRecord::Base before_create :generate_guid + validates :name, presence: true + private def generate_guid diff --git a/app/views/admin/sponsors/_form.html.haml b/app/views/admin/sponsors/_form.html.haml index fe5b12e2..5ec2fbd0 100644 --- a/app/views/admin/sponsors/_form.html.haml +++ b/app/views/admin/sponsors/_form.html.haml @@ -1,9 +1,9 @@ .row .col-md-12 .page-header - -if @sponsor.new_record? - New %h1 + -if @sponsor.new_record? + New Sponsor = @sponsor.name .row @@ -16,4 +16,4 @@ = f.input :website_url = f.input :sponsorship_level, collection: @conference.sponsorship_levels %p.text-right - = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } \ No newline at end of file + = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/spec/features/campaign_spec.rb b/spec/features/campaign_spec.rb index f95e296e..d1043f5d 100644 --- a/spec/features/campaign_spec.rb +++ b/spec/features/campaign_spec.rb @@ -18,7 +18,7 @@ feature Campaign do click_button 'Create Campaign' expect(flash). - to eq("Creating of Campaign for osc14 failed.Name can't be blank. Utm campaign can't be blank.") + to eq("Campaign creation failed. Name can't be blank and Utm campaign can't be blank") fill_in 'campaign_name', with: 'Test Campaign' fill_in 'campaign_utm_campaign', with: 'campaign' diff --git a/spec/features/registration_periods_spec.rb b/spec/features/registration_periods_spec.rb index 88035d76..341edbe9 100644 --- a/spec/features/registration_periods_spec.rb +++ b/spec/features/registration_periods_spec.rb @@ -17,7 +17,7 @@ feature RegistrationPeriod do click_button 'Save Registration Period' expect(flash). - to eq('A error prohibited the Registration Period from being saved: ' \ + to eq('An error prohibited the Registration Period from being saved: ' \ "Start date can't be blank. End date can't be blank.") page.