Testing tests
This commit is contained in:
@@ -125,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
|
||||
@@ -134,7 +140,7 @@ 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
|
||||
|
||||
|
||||
@@ -1,58 +1,69 @@
|
||||
class WorkshopsController < ApplicationController
|
||||
before_action :set_workshop, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_workshop, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /workshops
|
||||
def index
|
||||
@workshops = Workshop.all
|
||||
end
|
||||
# GET /workshops
|
||||
def index
|
||||
set_conference
|
||||
@workshops = Workshop.where(['conference_id = ?', @conference.id])
|
||||
end
|
||||
|
||||
# GET /workshops/1
|
||||
def show
|
||||
end
|
||||
# GET /workshops/1
|
||||
def show
|
||||
set_workshop
|
||||
set_conference
|
||||
end
|
||||
|
||||
# GET /workshops/new
|
||||
def new
|
||||
@workshop = Workshop.new
|
||||
end
|
||||
# GET /workshops/new
|
||||
def new
|
||||
set_conference
|
||||
@workshop = Workshop.new
|
||||
end
|
||||
|
||||
# GET /workshops/1/edit
|
||||
def edit
|
||||
end
|
||||
# GET /workshops/1/edit
|
||||
def edit
|
||||
set_conference
|
||||
end
|
||||
|
||||
# POST /workshops
|
||||
def create
|
||||
@workshop = Workshop.new(workshop_params)
|
||||
# POST /workshops
|
||||
def create
|
||||
set_conference
|
||||
@workshop = Workshop.new(workshop_params)
|
||||
|
||||
if @workshop.save
|
||||
redirect_to @workshop, notice: 'Workshop was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
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
|
||||
if @workshop.update(workshop_params)
|
||||
redirect_to @workshop, notice: 'Workshop was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
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
|
||||
# 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
|
||||
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
|
||||
|
||||
# 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
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user