Working on the backend interface for supporter registrations
This commit is contained in:
parent
e0f134bb34
commit
152e8a345d
66 changed files with 12860 additions and 17 deletions
19
app/controllers/admin/supporters_controller.rb
Normal file
19
app/controllers/admin/supporters_controller.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
class Admin::SupportersController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
layout "admin"
|
||||
|
||||
def index
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render json: DatatableSupporters.new(@conference.supporter_registrations, view_context) }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
params[:supporter_registration][:conference_id] = @conference.id
|
||||
supporter = SupporterRegistration.create!(params[:supporter_registration])
|
||||
flash[:notice] = "Supporter added"
|
||||
render :json => {"status" => "ok"}
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -12,7 +12,7 @@ class ConferenceRegistrationController < ApplicationController
|
|||
@registration = @person.registrations.new(:conference_id => @conference.id)
|
||||
end
|
||||
|
||||
@registration.supporter_registration ||= SupporterRegistration.new
|
||||
@registration.supporter_registration ||= SupporterRegistration.new(:conference_id => @conference.id)
|
||||
end
|
||||
|
||||
# TODO this is ugly
|
||||
|
|
@ -26,6 +26,7 @@ class ConferenceRegistrationController < ApplicationController
|
|||
update_registration = false
|
||||
person.update_attributes(params[:registration][:person_attributes])
|
||||
params[:registration].delete :person_attributes
|
||||
params[:registration][:supporter_registration_attributes]["conference_id"] = conference.id
|
||||
registration = person.registrations.new(params[:registration])
|
||||
registration.conference_id = conference.id
|
||||
registration.save!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue