mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-09 07:28:41 -07:00
working on schedules
This commit is contained in:
parent
72418edd7c
commit
2fb55a7443
26 changed files with 726 additions and 1 deletions
64
app/controllers/schedules_controller.rb
Normal file
64
app/controllers/schedules_controller.rb
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
class SchedulesController < ApplicationController
|
||||
before_action :set_school
|
||||
before_action :set_schedule, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET schools/1/schedules
|
||||
def index
|
||||
@schedules = @school.schedules
|
||||
end
|
||||
|
||||
# GET schools/1/schedules/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET schools/1/schedules/new
|
||||
def new
|
||||
@schedule = @school.schedules.build
|
||||
end
|
||||
|
||||
# GET schools/1/schedules/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST schools/1/schedules
|
||||
def create
|
||||
@schedule = @school.schedules.build(schedule_params)
|
||||
|
||||
if @schedule.save
|
||||
redirect_to([@schedule.school, @schedule], notice: 'Schedule was successfully created.')
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PUT schools/1/schedules/1
|
||||
def update
|
||||
if @schedule.update_attributes(schedule_params)
|
||||
redirect_to([@schedule.school, @schedule], notice: 'Schedule was successfully updated.')
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE schools/1/schedules/1
|
||||
def destroy
|
||||
@schedule.destroy
|
||||
|
||||
redirect_to @school
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_school
|
||||
@school = School.find(params[:school_id])
|
||||
end
|
||||
|
||||
def set_schedule
|
||||
@schedule = @school.schedules.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def schedule_params
|
||||
params.require(:schedule).permit(:name, :description, :school_id, :frequency_hours, :start_date, :end_date, :active, :random, :recipient_list_id, :question_list_id)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue