You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.3 KiB
59 lines
1.3 KiB
11 years ago
|
class WorkshopsController < ApplicationController
|
||
|
before_action :set_workshop, only: [:show, :edit, :update, :destroy]
|
||
|
|
||
|
# GET /workshops
|
||
|
def index
|
||
|
@workshops = Workshop.all
|
||
|
end
|
||
|
|
||
|
# GET /workshops/1
|
||
|
def show
|
||
|
end
|
||
|
|
||
|
# GET /workshops/new
|
||
|
def new
|
||
|
@workshop = Workshop.new
|
||
|
end
|
||
|
|
||
|
# GET /workshops/1/edit
|
||
|
def edit
|
||
|
end
|
||
|
|
||
|
# POST /workshops
|
||
|
def create
|
||
|
@workshop = Workshop.new(workshop_params)
|
||
|
|
||
|
if @workshop.save
|
||
|
redirect_to @workshop, notice: 'Workshop was successfully created.'
|
||
|
else
|
||
|
render action: 'new'
|
||
|
end
|
||
|
end
|
||
|
|
||
|
# PATCH/PUT /workshops/1
|
||
|
def update
|
||
|
if @workshop.update(workshop_params)
|
||
|
redirect_to @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(params[:id])
|
||
|
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
|