This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
phone_app/app/controllers/admin/s_modules_controller.rb
2021-08-23 10:26:02 +02:00

66 lines
909 B
Ruby

# -*- encoding : utf-8 -*-
class Admin::SModulesController < ApplicationController
layout "admin"
before_action :auth_admin
before_action :admin_space
def admin_space
@admin_space = "default"
end
def index
@s_modules = SModule.order(:name).all
end
def show
@s_module = SModule.find(params[:id])
end
def new
@s_module = SModule.new
end
def edit
@s_module = SModule.find(params[:id])
end
def create
@s_module = SModule.new(params.require(:s_module).permit!)
if @s_module.save
else
render action: "new"
end
end
def update
@s_module = SModule.find(params[:id])
if @s_module.update_attributes(params.require(:s_module).permit!)
else
render action: "edit"
end
end
def destroy
@s_module = SModule.find(params[:id])
@s_module.destroy
end
end