Merge branch 'master' into org-name-in-conf
This commit is contained in:
commit
e652880dd1
120 changed files with 2844 additions and 408 deletions
|
|
@ -7,9 +7,13 @@ module Admin
|
|||
|
||||
def show; end
|
||||
|
||||
def new; end
|
||||
def new
|
||||
@url = admin_conference_booths_path(@conference.short_title)
|
||||
end
|
||||
|
||||
def create
|
||||
@url = admin_conference_booths_path(@conference.short_title)
|
||||
|
||||
@booth = @conference.booths.new(booth_params)
|
||||
|
||||
@booth.submitter = current_user
|
||||
|
|
@ -23,9 +27,13 @@ module Admin
|
|||
end
|
||||
end
|
||||
|
||||
def edit; end
|
||||
def edit
|
||||
@url = admin_conference_booth_path(@conference.short_title, @booth.id)
|
||||
end
|
||||
|
||||
def update
|
||||
@url = admin_conference_booth_path(@conference.short_title, @booth.id)
|
||||
|
||||
@booth.update_attributes(booth_params)
|
||||
|
||||
if @booth.save
|
||||
|
|
@ -38,18 +46,19 @@ module Admin
|
|||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @booth.destroy
|
||||
redirect_to admin_conference_booths_path,
|
||||
notice: 'Booth successfully destroyed.'
|
||||
else
|
||||
redirect_to admin_conference_booths_path,
|
||||
error: "Booth couldn't be deleted. #{@booth.errors.full_messages.join('. ')}."
|
||||
end
|
||||
end
|
||||
|
||||
def accept
|
||||
update_state(:accept, 'Booth accepted!')
|
||||
@booth.accept!
|
||||
|
||||
if @booth.save
|
||||
if @conference.email_settings.send_on_booths_acceptance
|
||||
Mailbot.conference_booths_acceptance_mail(@booth).deliver
|
||||
end
|
||||
redirect_to admin_conference_booths_path(conference_id: @conference.short_title),
|
||||
notice: 'Booth successfully accepted!'
|
||||
else
|
||||
redirect_to admin_conference_booths_path(conference_id: @conference.short_title)
|
||||
flash[:error] = "Booth could not be accepted. #{@booth.errors.full_messages.to_sentence}."
|
||||
end
|
||||
end
|
||||
|
||||
def to_accept
|
||||
|
|
@ -61,7 +70,16 @@ module Admin
|
|||
end
|
||||
|
||||
def reject
|
||||
update_state(:reject, 'Booth rejected')
|
||||
@booth.reject!
|
||||
|
||||
if @booth.save
|
||||
Mailbot.conference_booths_rejection_mail(@booth).deliver
|
||||
redirect_to admin_conference_booths_path(conference_id: @conference.short_title),
|
||||
notice: 'Booth successfully rejected.'
|
||||
else
|
||||
redirect_to admin_conference_booths_path(conference_id: @conference.short_title)
|
||||
flash[:error] = "Booth could not be rejected. #{@booth.errors.full_messages.to_sentence}."
|
||||
end
|
||||
end
|
||||
|
||||
def restart
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ module Admin
|
|||
:vpositions_attributes, :use_volunteers, :color,
|
||||
:sponsorship_levels_attributes, :sponsors_attributes,
|
||||
:targets, :targets_attributes,
|
||||
:campaigns, :campaigns_attributes, :registration_limit, :organization_id, :ticket_layout)
|
||||
:campaigns, :campaigns_attributes, :registration_limit, :organization_id, :ticket_layout, :booth_limit)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ module Admin
|
|||
:send_on_conference_registration_dates_updated, :conference_registration_dates_updated_subject, :conference_registration_dates_updated_body,
|
||||
:send_on_venue_updated, :venue_updated_subject, :venue_updated_body,
|
||||
:send_on_cfp_dates_updated, :cfp_dates_updated_subject, :cfp_dates_updated_body,
|
||||
:send_on_program_schedule_public, :program_schedule_public_subject, :program_schedule_public_body)
|
||||
:send_on_program_schedule_public, :program_schedule_public_subject, :program_schedule_public_body,
|
||||
:send_on_booths_acceptance, :booths_acceptance_subject, :booths_acceptance_body,
|
||||
:send_on_booths_rejection, :booths_rejection_subject, :booths_rejection_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ module Admin
|
|||
|
||||
def index
|
||||
@events = @program.events
|
||||
@tracks = @program.tracks
|
||||
@tracks = @program.tracks.confirmed.cfp_active
|
||||
@difficulty_levels = @program.difficulty_levels
|
||||
@event_types = @program.event_types
|
||||
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)
|
||||
|
|
@ -43,7 +43,7 @@ module Admin
|
|||
end
|
||||
|
||||
def show
|
||||
@tracks = @program.tracks
|
||||
@tracks = @program.tracks.confirmed.cfp_active
|
||||
@event_types = @program.event_types
|
||||
@comments = @event.root_comments
|
||||
@comment_count = @event.comment_threads.count
|
||||
|
|
@ -58,7 +58,7 @@ module Admin
|
|||
|
||||
def edit
|
||||
@event_types = @program.event_types
|
||||
@tracks = Track.all
|
||||
@tracks = @program.tracks.confirmed.cfp_active
|
||||
@comments = @event.root_comments
|
||||
@comment_count = @event.comment_threads.count
|
||||
@user = @event.submitter
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ module Admin
|
|||
:include_tracks, :include_program, :include_cfp,
|
||||
:include_venue, :include_registrations,
|
||||
:include_tickets, :include_lodgings,
|
||||
:include_sponsors, :include_social_media)
|
||||
:include_sponsors, :include_social_media,
|
||||
:include_booths)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
16
app/controllers/admin/ticket_scannings_controller.rb
Normal file
16
app/controllers/admin/ticket_scannings_controller.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
module Admin
|
||||
class TicketScanningsController < Admin::BaseController
|
||||
before_action :authenticate_user!
|
||||
load_resource :physical_ticket, find_by: :token
|
||||
# We authorize manually in these actions
|
||||
skip_authorize_resource only: [:create]
|
||||
|
||||
def create
|
||||
@ticket_scanning = TicketScanning.new(physical_ticket: @physical_ticket)
|
||||
authorize! :create, @ticket_scanning
|
||||
@ticket_scanning.save
|
||||
redirect_to conferences_path,
|
||||
notice: "Ticket with token #{@physical_ticket.token} successfully scanned."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -50,7 +50,7 @@ module Admin
|
|||
private
|
||||
|
||||
def ticket_params
|
||||
params.require(:ticket).permit(:conference, :title, :url, :description, :conference_id, :price_cents, :price_currency, :price)
|
||||
params.require(:ticket).permit(:conference, :title, :url, :description, :conference_id, :price_cents, :price_currency, :price, :registration_ticket)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ module Admin
|
|||
load_and_authorize_resource :program, through: :conference, singleton: true
|
||||
load_and_authorize_resource through: :program, find_by: :short_name
|
||||
|
||||
# Show flash message with ajax calls
|
||||
after_action :prepare_unobtrusive_flash, only: :toggle_cfp_inclusion
|
||||
|
||||
def index; end
|
||||
|
||||
def show
|
||||
|
|
@ -19,6 +22,8 @@ module Admin
|
|||
|
||||
def create
|
||||
@track = @program.tracks.new(track_params)
|
||||
@track.state = 'confirmed'
|
||||
@track.cfp_active = true
|
||||
if @track.save
|
||||
redirect_to admin_conference_program_tracks_path(conference_id: @conference.short_title),
|
||||
notice: 'Track successfully created.'
|
||||
|
|
@ -53,16 +58,65 @@ module Admin
|
|||
def toggle_cfp_inclusion
|
||||
@track.cfp_active = !@track.cfp_active
|
||||
if @track.save
|
||||
head :ok
|
||||
flash[:notice] = "Successfully changed cfp inclusion of #{@track.name} to #{@track.cfp_active}"
|
||||
else
|
||||
head :unprocessable_entity
|
||||
flash[:error] = "Failed to toggle cfp inclusion of #{@track.name} to #{@track.cfp_active}"
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def restart
|
||||
update_state(:restart, "Review for #{@track.name} started!")
|
||||
end
|
||||
|
||||
def to_accept
|
||||
update_state(:to_accept, "Track #{@track.name} marked as a possible acceptance!")
|
||||
end
|
||||
|
||||
def accept
|
||||
if @track.room && @track.start_date && @track.end_date
|
||||
update_state(:accept, "Track #{@track.name} accepted!")
|
||||
else
|
||||
flash[:alert] = 'Please make sure that the track has a room and start/end dates before accepting it'
|
||||
redirect_to edit_admin_conference_program_track_path(@conference.short_title, @track)
|
||||
end
|
||||
end
|
||||
|
||||
def confirm
|
||||
update_state(:confirm, "Track #{@track.name} confirmed!")
|
||||
end
|
||||
|
||||
def to_reject
|
||||
update_state(:to_reject, "Track #{@track.name} marked as a possible rejection!")
|
||||
end
|
||||
|
||||
def reject
|
||||
update_state(:reject, "Track #{@track.name} rejected!")
|
||||
end
|
||||
|
||||
def cancel
|
||||
update_state(:cancel, "Track #{@track.name} canceled!")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def track_params
|
||||
params.require(:track).permit(:name, :description, :color, :short_name, :cfp_active)
|
||||
params.require(:track).permit(:name, :description, :color, :short_name, :cfp_active, :start_date, :end_date, :room_id)
|
||||
end
|
||||
|
||||
def update_state(transition, notice)
|
||||
errors = @track.update_state(transition)
|
||||
|
||||
if errors.blank?
|
||||
flash[:notice] = notice
|
||||
else
|
||||
flash[:error] = errors
|
||||
end
|
||||
|
||||
redirect_back_or_to(admin_conference_program_tracks_path(conference_id: @conference.short_title))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
97
app/controllers/booths_controller.rb
Normal file
97
app/controllers/booths_controller.rb
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
class BoothsController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
load_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource through: :conference
|
||||
skip_authorize_resource only: [:withdraw, :confirm, :restart]
|
||||
|
||||
def index
|
||||
@booths = current_user.booths.where(conference_id: @conference.id).uniq
|
||||
end
|
||||
|
||||
def show; end
|
||||
|
||||
def new
|
||||
@url = conference_booths_path(@conference.short_title)
|
||||
end
|
||||
|
||||
def create
|
||||
@url = conference_booths_path(@conference.short_title)
|
||||
|
||||
@booth.submitter = current_user
|
||||
|
||||
if @booth.save
|
||||
redirect_to conference_booths_path,
|
||||
notice: 'Booth successfully created.'
|
||||
else
|
||||
flash[:error] = "Creating booth failed. #{@booth.errors.full_messages.to_sentence}."
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@url = conference_booth_path(@conference.short_title, @booth.id)
|
||||
end
|
||||
|
||||
def update
|
||||
@url = conference_booth_path(@conference.short_title, @booth.id)
|
||||
@booth.update_attributes(booth_params)
|
||||
|
||||
if @booth.save
|
||||
redirect_to conference_booths_path,
|
||||
notice: 'Booth successfully updated!'
|
||||
else
|
||||
flash[:error] = "Booth could not be updated. #{@booth.errors.full_messages.to_sentence}."
|
||||
end
|
||||
end
|
||||
|
||||
def destroy; end
|
||||
|
||||
def withdraw
|
||||
authorize! :update, @booth
|
||||
@url = conference_booth_path(@conference.short_title, @booth.id)
|
||||
|
||||
@booth.withdraw!
|
||||
|
||||
if @booth.save
|
||||
redirect_to conference_booths_path,
|
||||
notice: 'Booth successfully withdrawn'
|
||||
else
|
||||
flash[:error] = "Booth could not be withdrawn. #{@booth.errors.full_messages.to_sentence}."
|
||||
end
|
||||
end
|
||||
|
||||
def confirm
|
||||
authorize! :update, @booth
|
||||
@url = conference_booth_path(@conference.short_title, @booth.id)
|
||||
|
||||
@booth.confirm!
|
||||
|
||||
if @booth.save
|
||||
redirect_to conference_booths_path,
|
||||
notice: 'Booth successfully confirmed'
|
||||
else
|
||||
flash[:error] = "Booth could not be confirmed. #{@booth.errors.full_messages.to_sentence}."
|
||||
end
|
||||
end
|
||||
|
||||
def restart
|
||||
authorize! :update, @booth
|
||||
@url = conference_booth_path(@conference.short_title, @booth.id)
|
||||
|
||||
@booth.restart!
|
||||
|
||||
if @booth.save
|
||||
redirect_to conference_booths_path,
|
||||
notice: 'Booth successfully re-submitted'
|
||||
else
|
||||
flash[:error] = "Booth could not be re-submitted. #{@booth.errors.full_messages.to_sentence}."
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def booth_params
|
||||
params.require(:booth).permit(:title, :description, :reasoning, :state, :picture, :conference_id,
|
||||
:created_at, :updated_at, :submitter_relationship, :website_url, responsible_ids: [])
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
class PhysicalTicketController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
load_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource
|
||||
load_and_authorize_resource find_by: :token
|
||||
authorize_resource :conference_registrations, class: Registration
|
||||
|
||||
def index
|
||||
|
|
|
|||
|
|
@ -5,17 +5,19 @@ class SubscriptionsController < ApplicationController
|
|||
|
||||
def create
|
||||
@subscription = current_user.subscriptions.build(conference_id: @conference.id)
|
||||
if @subscription.save!
|
||||
redirect_to root_path, notice: "You have been subscribed to receive email notifications for #{@conference.short_title}."
|
||||
if @subscription.save
|
||||
redirect_to root_path, notice: "You have subscribed to receive email notifications for #{@conference.title}."
|
||||
else
|
||||
redirect_to root_path, error: subscription.errors.full_messages.to_sentence
|
||||
redirect_to root_path, error: @subscription.errors.full_messages.to_sentence
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@subscription = current_user.subscriptions.find_by(conference_id: @conference.id)
|
||||
|
||||
redirect_to(root_path, error: "You are not subscribed to #{@conference.title}.") && return unless @subscription
|
||||
if @subscription.destroy
|
||||
redirect_to root_path, notice: "You have been unsubscribed and now you will not be receiving email notifications for #{@conference.short_title}."
|
||||
redirect_to root_path, notice: "You have unsubscribed and you will not be receiving email notifications for #{@conference.title}."
|
||||
else
|
||||
redirect_to root_path, error: @subscription.errors.full_messages.to_sentence
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class TracksController < ApplicationController
|
|||
load_and_authorize_resource through: :program, find_by: :short_name
|
||||
|
||||
def index
|
||||
@tracks = current_user.tracks.where(program: @program)
|
||||
@tracks = @tracks.where(submitter: current_user)
|
||||
end
|
||||
|
||||
def show; end
|
||||
|
|
@ -18,7 +18,6 @@ class TracksController < ApplicationController
|
|||
def create
|
||||
@track = @program.tracks.new(track_params)
|
||||
@track.submitter = current_user
|
||||
@track.state = 'new'
|
||||
@track.cfp_active = false
|
||||
if @track.save
|
||||
redirect_to conference_program_tracks_path(conference_id: @conference.short_title),
|
||||
|
|
@ -39,9 +38,33 @@ class TracksController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def restart
|
||||
update_state(:restart, "Track #{@track.name} re-submitted.")
|
||||
end
|
||||
|
||||
def confirm
|
||||
update_state(:confirm, "Track #{@track.name} confirmed.")
|
||||
end
|
||||
|
||||
def withdraw
|
||||
update_state(:withdraw, "Track #{@track.name} withdrawn.")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def track_params
|
||||
params.require(:track).permit(:name, :description, :color, :short_name)
|
||||
params.require(:track).permit(:name, :description, :color, :short_name, :start_date, :end_date, :relevance)
|
||||
end
|
||||
|
||||
def update_state(transition, notice)
|
||||
errors = @track.update_state(transition)
|
||||
|
||||
if errors.blank?
|
||||
flash[:notice] = notice
|
||||
else
|
||||
flash[:error] = errors
|
||||
end
|
||||
|
||||
redirect_back_or_to(conference_program_tracks_path(conference_id: @conference.short_title))
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue