Workshop and event scaffolds

This commit is contained in:
Godwin
2014-03-15 13:40:38 -06:00
parent 3d6ad3b432
commit 8e26bb1797
62 changed files with 933 additions and 1 deletions
+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
@@ -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