class Admin::SeminarItemsController < OrbitAdminController def initialize super @app_title = 'seminar' end def index @seminar_items = SeminarItem.all @url = admin_seminar_item_path(@seminar_items) end def create @seminar_item = SeminarItem.new(seminar_item_params) @seminar_item.save redirect_to request.referer, :status => 303 end def create_in_form @seminar_item = SeminarItem.new(seminar_item_params) @seminar_item.saveseminar_item render :json => {:id=>@seminar_item.id.to_s, :title=>@seminar_item.title}.to_json ,:layout => false end def update @seminar_item = SeminarItem.find(params[:id]) @seminar_item.update_attributes(seminar_item_params) redirect_to request.referer, :status => 303 end def toggle @seminar_item = SeminarItem.find(params[:id]) @seminar_item.save! redirect_to request.referer, :status => 303 end def delete_items items = SeminarItem.find(params[:ids].split(',')) rescue nil if items items.each(&:destroy) end redirect_to request.referer, :status => 303 end private def seminar_item_params params.require(:seminar_item).permit! end end