# -*- encoding : utf-8 -*-

class Admin::SModuleConfigurationsController < ApplicationController
  layout "admin"
  before_action :auth_admin

  before_action :admin_space
  
  def admin_space
    @admin_space = "default"
  end
  
  def index
    @s_module_configurations = SModuleConfiguration.order(:name).all

  end

  def show
    @s_module_configuration = SModuleConfiguration.find(params[:id])

  end

  def new
    @s_module_configuration = SModuleConfiguration.new
  
  end

  def edit
    @s_module_configuration = SModuleConfiguration.find(params[:id])
    
  end

  def create
    @s_module_configuration = SModuleConfiguration.new(params.require(:s_module_configuration).permit!)

    if @s_module_configuration.save
      
    else
      render action: "new"
 
    end

  end


  def update
    @s_module_configuration = SModuleConfiguration.find(params[:id])


    if @s_module_configuration.update_attributes(params.require(:s_module_configuration).permit!)
      
    else
     render action: "edit" 
      
    end
      
  end


  def destroy
    @s_module_configuration = SModuleConfiguration.find(params[:id])
    @s_module_configuration.destroy
    
  end
end
