style fixes
This commit is contained in:
parent
eaf637e9bd
commit
f7ef401be7
9 changed files with 29 additions and 54 deletions
|
|
@ -1,30 +1,30 @@
|
||||||
module Admin
|
module Admin
|
||||||
class ContactsController < ApplicationController
|
class ContactsController < ApplicationController
|
||||||
load_and_authorize_resource :conference, find_by: :short_title
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
load_and_authorize_resource through: :conference, singleton: true
|
load_and_authorize_resource through: :conference, singleton: true
|
||||||
|
|
||||||
# GET /:conference/contact
|
# GET /:conference/contact
|
||||||
def show; end
|
def show; end
|
||||||
|
|
||||||
# GET /:conference/contact/edit
|
# GET /:conference/contact/edit
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
||||||
# PATCH/PUT /:conference/contact
|
# PATCH/PUT /:conference/contact
|
||||||
def update
|
def update
|
||||||
if @contact.update(contact_params)
|
if @contact.update(contact_params)
|
||||||
redirect_to admin_conference_contact_path, notice: 'Contact details were successfully updated.'
|
redirect_to admin_conference_contact_path, notice: 'Contact details were successfully updated.'
|
||||||
else
|
else
|
||||||
render :edit
|
render :edit
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# DELETE /:conference/contact
|
# DELETE /:conference/contact
|
||||||
def destroy
|
def destroy
|
||||||
@contact.destroy
|
@contact.destroy
|
||||||
redirect_to admin_conference_contacts_url, notice: 'Contact details were successfully destroyed.'
|
redirect_to admin_conference_contacts_url, notice: 'Contact details were successfully destroyed.'
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Only allow a trusted parameter "white list" through.
|
# Only allow a trusted parameter "white list" through.
|
||||||
def contact_params
|
def contact_params
|
||||||
# params.require(:contact).permit(:social_tag, :email, :facebook, :googleplus, :twitter, :instagram, :public)
|
# params.require(:contact).permit(:social_tag, :email, :facebook, :googleplus, :twitter, :instagram, :public)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ module Admin
|
||||||
redirect_to(admin_conference_event_types_path(
|
redirect_to(admin_conference_event_types_path(
|
||||||
conference_id: @conference.short_title),
|
conference_id: @conference.short_title),
|
||||||
notice: 'Event types were successfully updated.')
|
notice: 'Event types were successfully updated.')
|
||||||
rescue Exception => e
|
rescue => e
|
||||||
redirect_to(admin_conference_event_types_path(
|
redirect_to(admin_conference_event_types_path(
|
||||||
conference_id: @conference.short_title),
|
conference_id: @conference.short_title),
|
||||||
alert: "Event types update failed: #{e.message}")
|
alert: "Event types update failed: #{e.message}")
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -57,7 +57,6 @@ module Admin
|
||||||
|
|
||||||
# DELETE questions/1
|
# DELETE questions/1
|
||||||
def destroy
|
def destroy
|
||||||
|
|
||||||
if can? :destroy, @question
|
if can? :destroy, @question
|
||||||
# Do not delete global questions
|
# Do not delete global questions
|
||||||
if @question.global == false
|
if @question.global == false
|
||||||
|
|
@ -71,7 +70,7 @@ module Admin
|
||||||
a.delete
|
a.delete
|
||||||
end
|
end
|
||||||
flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map {|a| a.title}.join ','}"
|
flash[:notice] = "Deleted question: #{@question.title} and its answers: #{@question.answers.map {|a| a.title}.join ','}"
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::RecordInvalid
|
rescue ActiveRecord::RecordInvalid
|
||||||
flash[:error] = "Could not delete question."
|
flash[:error] = "Could not delete question."
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ module Admin
|
||||||
begin
|
begin
|
||||||
@conference.update_attributes!(params[:conference])
|
@conference.update_attributes!(params[:conference])
|
||||||
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: "Volunteering options were successfully updated.")
|
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}")
|
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{e.message}")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ class EventAttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
||||||
if @upload.public?
|
if @upload.public?
|
||||||
send_file @upload.attachment.path
|
send_file @upload.attachment.path
|
||||||
return
|
return
|
||||||
|
|
@ -84,7 +83,6 @@ class EventAttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @upload.update_attributes(params[:upload])
|
if @upload.update_attributes(params[:upload])
|
||||||
format.html { redirect_to @upload, notice: 'Upload was successfully updated.' }
|
format.html { redirect_to @upload, notice: 'Upload was successfully updated.' }
|
||||||
|
|
@ -97,7 +95,6 @@ class EventAttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
||||||
if can? :destroy, @proposal
|
if can? :destroy, @proposal
|
||||||
@upload = @proposal.event_attachments.find(params[:id])
|
@upload = @proposal.event_attachments.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,10 @@ class Ability
|
||||||
# The following is wrong because a user will only have 'cfp' role for a specific conference
|
# The following is wrong because a user will only have 'cfp' role for a specific conference
|
||||||
# user.is_cfp? # This is always false
|
# user.is_cfp? # This is always false
|
||||||
|
|
||||||
|
|
||||||
user ||= User.new # guest user (not logged in)
|
user ||= User.new # guest user (not logged in)
|
||||||
|
|
||||||
if user.new_record?
|
if user.new_record?
|
||||||
guest(user)
|
guest
|
||||||
else
|
else
|
||||||
roles = Role::ACTIONABLES.map {|i| i.parameterize.underscore}
|
roles = Role::ACTIONABLES.map {|i| i.parameterize.underscore}
|
||||||
if (user.roles.pluck(:name) & roles).empty? && !user.is_admin # User has no roles
|
if (user.roles.pluck(:name) & roles).empty? && !user.is_admin # User has no roles
|
||||||
|
|
@ -100,7 +99,7 @@ class Ability
|
||||||
can :manage, SponsorshipLevel, conference_id: conf_ids_for_organizer
|
can :manage, SponsorshipLevel, conference_id: conf_ids_for_organizer
|
||||||
can :manage, SupporterLevel, conference_id: conf_ids_for_organizer
|
can :manage, SupporterLevel, conference_id: conf_ids_for_organizer
|
||||||
can :manage, Target, conference_id: conf_ids_for_organizer
|
can :manage, Target, conference_id: conf_ids_for_organizer
|
||||||
can :manage, Commercial#, commercialable_type: 'Conference', commercialable_id: conf_ids_for_organizer
|
can :manage, Commercial # , commercialable_type: 'Conference', commercialable_id: conf_ids_for_organizer
|
||||||
can :index, Commercial, commercialable_type: 'Conference'
|
can :index, Commercial, commercialable_type: 'Conference'
|
||||||
# Manage commercials for events that belong to a conference of which user is organizer
|
# Manage commercials for events that belong to a conference of which user is organizer
|
||||||
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(conference_id: conf_ids_for_organizer + conf_ids_for_cfp).pluck(:id)
|
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(conference_id: conf_ids_for_organizer + conf_ids_for_cfp).pluck(:id)
|
||||||
|
|
@ -108,7 +107,7 @@ class Ability
|
||||||
can :manage, Campaign, conference_id: conf_ids_for_organizer
|
can :manage, Campaign, conference_id: conf_ids_for_organizer
|
||||||
end
|
end
|
||||||
|
|
||||||
def guest(user)
|
def guest
|
||||||
## Abilities for everyone, even guests (not logged in users)
|
## Abilities for everyone, even guests (not logged in users)
|
||||||
can [:show, :gallery_photos], Conference do |conference|
|
can [:show, :gallery_photos], Conference do |conference|
|
||||||
conference.make_conference_public == true
|
conference.make_conference_public == true
|
||||||
|
|
@ -122,7 +121,7 @@ class Ability
|
||||||
end
|
end
|
||||||
|
|
||||||
def signed_in(user)
|
def signed_in(user)
|
||||||
guest(user) # Inherits abilities of guest
|
guest # Inherits abilities of guest
|
||||||
|
|
||||||
# Conference Registration
|
# Conference Registration
|
||||||
can :manage, Registration, user_id: user.id
|
can :manage, Registration, user_id: user.id
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
# Questions
|
# Questions
|
||||||
qtype_yesno = QuestionType.create(title: 'Yes/No')
|
qtype_yesno = QuestionType.create(title: 'Yes/No')
|
||||||
qtype_single = QuestionType.create(title: 'Single Choice')
|
QuestionType.create(title: 'Single Choice')
|
||||||
qtype_multiple = QuestionType.create(title: 'Multiple Choice')
|
QuestionType.create(title: 'Multiple Choice')
|
||||||
|
|
||||||
answer_yes = Answer.create(title: 'Yes')
|
answer_yes = Answer.create(title: 'Yes')
|
||||||
answer_no = Answer.create(title: 'No')
|
answer_no = Answer.create(title: 'No')
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ describe Admin::ConferenceController do
|
||||||
mailer = double
|
mailer = double
|
||||||
allow(mailer).to receive(:deliver)
|
allow(mailer).to receive(:deliver)
|
||||||
conference.email_settings = create(:email_settings)
|
conference.email_settings = create(:email_settings)
|
||||||
patch :update, id: conference.short_title#, conference: attributes_for(:conference, start_date: Date.today + 2.days, end_date: Date.today + 4.days)
|
patch :update, id: conference.short_title, conference: attributes_for(:conference, start_date: Date.today + 2.days, end_date: Date.today + 4.days)
|
||||||
conference.reload
|
conference.reload
|
||||||
allow(Mailbot).to receive(:conference_date_update_mail).and_return(mailer)
|
allow(Mailbot).to receive(:conference_date_update_mail).and_return(mailer)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue