style fixes

This commit is contained in:
Stella Rouzi 2014-08-12 20:23:51 +03:00
parent eaf637e9bd
commit f7ef401be7
9 changed files with 29 additions and 54 deletions

View file

@ -1,30 +1,30 @@
module Admin
class ContactsController < ApplicationController
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource through: :conference, singleton: true
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource through: :conference, singleton: true
# GET /:conference/contact
def show; end
# GET /:conference/contact
def show; end
# GET /:conference/contact/edit
def edit; end
# GET /:conference/contact/edit
def edit; end
# PATCH/PUT /:conference/contact
def update
if @contact.update(contact_params)
redirect_to admin_conference_contact_path, notice: 'Contact details were successfully updated.'
else
render :edit
# PATCH/PUT /:conference/contact
def update
if @contact.update(contact_params)
redirect_to admin_conference_contact_path, notice: 'Contact details were successfully updated.'
else
render :edit
end
end
end
# DELETE /:conference/contact
def destroy
@contact.destroy
redirect_to admin_conference_contacts_url, notice: 'Contact details were successfully destroyed.'
end
# DELETE /:conference/contact
def destroy
@contact.destroy
redirect_to admin_conference_contacts_url, notice: 'Contact details were successfully destroyed.'
end
private
private
# Only allow a trusted parameter "white list" through.
def contact_params
# params.require(:contact).permit(:social_tag, :email, :facebook, :googleplus, :twitter, :instagram, :public)

View file

@ -16,7 +16,7 @@ module Admin
redirect_to(admin_conference_event_types_path(
conference_id: @conference.short_title),
notice: 'Event types were successfully updated.')
rescue Exception => e
rescue => e
redirect_to(admin_conference_event_types_path(
conference_id: @conference.short_title),
alert: "Event types update failed: #{e.message}")

View file

@ -1,20 +0,0 @@
module Admin
class EventtypesController < ApplicationController
before_filter :verify_organizer
def show
render :eventtypes
end
def update
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_eventtypes_path(
conference_id: @conference.short_title),
notice: 'Event types were successfully updated.')
rescue => e
redirect_to(admin_conference_eventtypes_path(
conference_id: @conference.short_title),
alert: "Event types update failed: #{e.message}")
end
end
end

View file

@ -57,7 +57,6 @@ module Admin
# DELETE questions/1
def destroy
if can? :destroy, @question
# Do not delete global questions
if @question.global == false
@ -71,7 +70,7 @@ module Admin
a.delete
end
flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map {|a| a.title}.join ','}"
end
end
rescue ActiveRecord::RecordInvalid
flash[:error] = "Could not delete question."
end

View file

@ -27,7 +27,7 @@ module Admin
begin
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: "Volunteering options were successfully updated.")
rescue Exception => e
rescue => e
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{e.message}")
end
else