Sha256: e876794683a65596ebe642074e72c4d2d59c8cb23b01b0a0ea2077008757dd98
Contents?: true
Size: 1.82 KB
Versions: 16
Compression:
Stored size: 1.82 KB
Contents
module Gaku module Admin class SchoolsController < BaseController include AdminPictureController respond_to :js, only: %i( new create destroy index edit update ) respond_to :html, only: %i( edit_master edit update_master show ) before_action :set_school, only: %i( edit show update destroy set_picture remove_picture ) before_action :set_master_school, only: %i( edit_master update_master ) def edit_master respond_with @school end def destroy @school.destroy set_count respond_with @school end def new @school = School.new respond_with @school end def create @school = School.new(school_params) @school.save set_count respond_with @school end def edit respond_with @school end def show respond_with @school end def update @school.update(school_params) respond_with @school end def update_master @school.update(school_params) respond_with @school, location: admin_school_details_edit_path end def index @schools = School.all set_count respond_with @schools end private def school_params params.require(:school).permit(attributes) end def attributes [:name, :primary, :slogan, :description, :founded, :principal, :vice_principal, :grades, :code, :picture, { levels_attributes: level_attributes }] end def level_attributes [:name, :'_destroy', :id] end def set_school @school = School.find(params[:id]) end def set_count @count = School.count end def set_master_school @school = School.primary end end end end
Version data entries
16 entries across 16 versions & 2 rubygems