Conflicts:
	Gemfile
	Gemfile.lock
This commit is contained in:
Graham Kaplan
2014-04-05 19:27:05 -07:00
91 changed files with 1409 additions and 103 deletions
+19 -2
View File
@@ -37,6 +37,7 @@ class ConferencesController < ApplicationController
registration = ConferenceRegistration.find_by(:user_id => current_user.id, :conference_id => @conference.id)
if registration
registration.conference_registration_responses.destroy_all
registration.is_attending = params[:is_attending]
else
registration = ConferenceRegistration.new(user_id: current_user.id, conference_id: @conference.id, is_attending: params[:is_attending])
end
@@ -53,7 +54,7 @@ class ConferencesController < ApplicationController
end
end
data.each do |key, value|
registration.conference_registration_responses << ConferenceRegistrationResponse.new(registration_form_field_id: key.to_i, data: value.to_json.to_s)
registration.conference_registration_responses << ConferenceRegistrationResponse.new(registration_form_field_id: key.to_i, data: value.to_json)
end
registration.save!
render action: 'show'
@@ -124,6 +125,12 @@ class ConferencesController < ApplicationController
set_conference
end
def workshops
set_conference
@workshops = Workshop.where(:conference_id => @conference.id)
render 'workshops/index'
end
# DELETE /conferences/1
def destroy
@conference.destroy
@@ -133,7 +140,17 @@ class ConferencesController < ApplicationController
private
# Use callbacks to share common setup or constraints between actions.
def set_conference
@conference = Conference.find_by(slug: params[:slug] || params[:conference_slug])
@conference = Conference.find_by(slug: params[:conference_slug] || params[:slug])
set_conference_registration
end
def set_conference_registration
if !@conference || !current_user
@conference_registration = nil
return
end
@conference_registration = ConferenceRegistration.find_by(conference_id: @conference.id, user_id: current_user.id)
end
# Only allow a trusted parameter "white list" through.
+58
View File
@@ -0,0 +1,58 @@
class EventTypesController < ApplicationController
before_action :set_event_type, only: [:show, :edit, :update, :destroy]
# GET /event_types
def index
@event_types = EventType.all
end
# GET /event_types/1
def show
end
# GET /event_types/new
def new
@event_type = EventType.new
end
# GET /event_types/1/edit
def edit
end
# POST /event_types
def create
@event_type = EventType.new(event_type_params)
if @event_type.save
redirect_to @event_type, notice: 'Event type was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /event_types/1
def update
if @event_type.update(event_type_params)
redirect_to @event_type, notice: 'Event type was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /event_types/1
def destroy
@event_type.destroy
redirect_to event_types_url, notice: 'Event type was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_event_type
@event_type = EventType.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def event_type_params
params.require(:event_type).permit(:slug, :info)
end
end
+58
View File
@@ -0,0 +1,58 @@
class EventsController < ApplicationController
before_action :set_event, only: [:show, :edit, :update, :destroy]
# GET /events
def index
@events = Event.all
end
# GET /events/1
def show
end
# GET /events/new
def new
@event = Event.new
end
# GET /events/1/edit
def edit
end
# POST /events
def create
@event = Event.new(event_params)
if @event.save
redirect_to @event, notice: 'Event was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /events/1
def update
if @event.update(event_params)
redirect_to @event, notice: 'Event was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /events/1
def destroy
@event.destroy
redirect_to events_url, notice: 'Event was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_event
@event = Event.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def event_params
params.require(:event).permit(:title, :slug, :event_type_id, :conference, :info, :location, :start_time, :end_time)
end
end
@@ -38,7 +38,10 @@ class RegistrationFormFieldsController < ApplicationController
private
def ajax_return(success)
@registration_form_fields = RegistrationFormField.all
if params[:conference_id]
@conference = Conference.find(params[:conference_id])
@registration_form_fields = RegistrationFormField.where(["id NOT IN (?)", @conference.registration_form_fields.map(&:id)])
end
if success
@registration_form_field = RegistrationFormField.new
end
@@ -54,13 +57,11 @@ class RegistrationFormFieldsController < ApplicationController
# Only allow a trusted parameter "white list" through.
def registration_form_field_params
#type = params[:type]
#allowed = RegistrationFormField::Types[type]
#allowed << 'field_type'
rff_params = params.require(:registration_form_field)
allowed = RegistrationFormField::GetNonOptionKeys(rff_params[:field_type], rff_params)
p = rff_params.send('permit', *allowed)#permit(:title, :help, :required, :field_type, :options, :is_retired)
p[:options] = RegistrationFormField::GetOptions(rff_params[:field_type], rff_params).to_json.to_s
p[:field_type] = rff_params[:field_type]
p
end
end
@@ -0,0 +1,58 @@
class WorkshopFacilitatorsController < ApplicationController
before_action :set_workshop_facilitator, only: [:show, :edit, :update, :destroy]
# GET /workshop_facilitators
def index
@workshop_facilitators = WorkshopFacilitator.all
end
# GET /workshop_facilitators/1
def show
end
# GET /workshop_facilitators/new
def new
@workshop_facilitator = WorkshopFacilitator.new
end
# GET /workshop_facilitators/1/edit
def edit
end
# POST /workshop_facilitators
def create
@workshop_facilitator = WorkshopFacilitator.new(workshop_facilitator_params)
if @workshop_facilitator.save
redirect_to @workshop_facilitator, notice: 'Workshop facilitator was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /workshop_facilitators/1
def update
if @workshop_facilitator.update(workshop_facilitator_params)
redirect_to @workshop_facilitator, notice: 'Workshop facilitator was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /workshop_facilitators/1
def destroy
@workshop_facilitator.destroy
redirect_to workshop_facilitators_url, notice: 'Workshop facilitator was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_workshop_facilitator
@workshop_facilitator = WorkshopFacilitator.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def workshop_facilitator_params
params.require(:workshop_facilitator).permit(:user_id, :workshop_id, :role)
end
end
@@ -0,0 +1,58 @@
class WorkshopRequestedResourcesController < ApplicationController
before_action :set_workshop_requested_resource, only: [:show, :edit, :update, :destroy]
# GET /workshop_requested_resources
def index
@workshop_requested_resources = WorkshopRequestedResource.all
end
# GET /workshop_requested_resources/1
def show
end
# GET /workshop_requested_resources/new
def new
@workshop_requested_resource = WorkshopRequestedResource.new
end
# GET /workshop_requested_resources/1/edit
def edit
end
# POST /workshop_requested_resources
def create
@workshop_requested_resource = WorkshopRequestedResource.new(workshop_requested_resource_params)
if @workshop_requested_resource.save
redirect_to @workshop_requested_resource, notice: 'Workshop requested resource was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /workshop_requested_resources/1
def update
if @workshop_requested_resource.update(workshop_requested_resource_params)
redirect_to @workshop_requested_resource, notice: 'Workshop requested resource was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /workshop_requested_resources/1
def destroy
@workshop_requested_resource.destroy
redirect_to workshop_requested_resources_url, notice: 'Workshop requested resource was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_workshop_requested_resource
@workshop_requested_resource = WorkshopRequestedResource.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def workshop_requested_resource_params
params.require(:workshop_requested_resource).permit(:workshop_id, :workshop_resource_id, :status)
end
end
+69
View File
@@ -0,0 +1,69 @@
class WorkshopsController < ApplicationController
before_action :set_workshop, only: [:show, :edit, :update, :destroy]
# GET /workshops
def index
set_conference
@workshops = Workshop.where(['conference_id = ?', @conference.id])
end
# GET /workshops/1
def show
set_workshop
set_conference
end
# GET /workshops/new
def new
set_conference
@workshop = Workshop.new
end
# GET /workshops/1/edit
def edit
set_conference
end
# POST /workshops
def create
set_conference
@workshop = Workshop.new(workshop_params)
if @workshop.save
redirect_to conference_workshop_path(@conference, @workshop), notice: 'Workshop was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /workshops/1
def update
set_conference
if @workshop.update(workshop_params)
redirect_to conference_workshop_path(@conference, @workshop), notice: 'Workshop was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /workshops/1
def destroy
@workshop.destroy
redirect_to workshops_url, notice: 'Workshop was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_workshop
@workshop = Workshop.find_by(slug: params[:workshop_slug] || params[:slug])
end
def set_conference
@conference = Conference.find_by(slug: params[:conference_slug] || params[:slug])
end
# Only allow a trusted parameter "white list" through.
def workshop_params
params.require(:workshop).permit(:title, :slug, :info, :conference_id, :workshop_stream_id, :workshop_presentation_style, :min_facilitators, :location_id, :start_time, :end_time)
end
end