Registration for Events
This commit is contained in:
parent
f188fd5575
commit
01ec43e53a
35 changed files with 522 additions and 46 deletions
|
|
@ -3,6 +3,7 @@ module Admin
|
|||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :program, through: :conference, singleton: true
|
||||
load_and_authorize_resource :event, through: :program
|
||||
load_and_authorize_resource :events_registration, only: :toggle_attendance
|
||||
|
||||
before_action :get_event, except: [:index, :create]
|
||||
|
||||
|
|
@ -116,7 +117,7 @@ module Admin
|
|||
end
|
||||
else
|
||||
@url = admin_conference_program_event_path(@conference.short_title, @event)
|
||||
flash[:notice] = 'Update not successful. ' + @event.errors.full_messages.to_sentence
|
||||
flash[:error] = 'Update not successful. ' + @event.errors.full_messages.to_sentence
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
|
@ -165,6 +166,20 @@ module Admin
|
|||
end
|
||||
end
|
||||
|
||||
def registrations
|
||||
@event_registrations = @event.events_registrations
|
||||
end
|
||||
|
||||
def toggle_attendance
|
||||
@events_registration.attended = !@events_registration.attended
|
||||
|
||||
if @events_registration.save
|
||||
head :ok
|
||||
else
|
||||
head :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def event_params
|
||||
|
|
@ -172,7 +187,7 @@ module Admin
|
|||
# Set also in proposals controller
|
||||
:title, :subtitle, :event_type_id, :abstract, :description, :require_registration, :difficulty_level_id,
|
||||
# Set only in admin/events controller
|
||||
:track_id, :state, :language, :start_time, :is_highlight,
|
||||
:track_id, :state, :language, :start_time, :is_highlight, :max_attendees,
|
||||
# Not used anymore?
|
||||
:proposal_additional_speakers, :user, :users_attributes)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@workshops = @registration.workshops
|
||||
@total_price = Ticket.total_price(@conference, current_user)
|
||||
@tickets = current_user.ticket_purchases.where(conference_id: @conference.id)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -145,10 +145,14 @@ class ProposalController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def registrations; end
|
||||
|
||||
private
|
||||
|
||||
def event_params
|
||||
params.require(:event).permit(:title, :subtitle, :track_id, :event_type_id, :abstract, :description, :require_registration, :difficulty_level_id)
|
||||
params.require(:event).permit(:event_type_id, :track_id, :difficulty_level_id,
|
||||
:title, :subtitle, :abstract, :description,
|
||||
:require_registration, :max_attendees)
|
||||
end
|
||||
|
||||
def user_params
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue