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

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

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

  end

  def show
    @s_site_type = SSiteType.find(params[:id])

  end

  def new
    @s_site_type = SSiteType.new
  
  end

  def edit
    @s_site_type = SSiteType.find(params[:id])
    
  end

  def create
    @s_site_type = SSiteType.new(params.require(:s_site_type).permit!)

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

  end


  def update
    @s_site_type = SSiteType.find(params[:id])


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


  def destroy
    @s_site_type = SSiteType.find(params[:id])
    @s_site_type.destroy
    
  end
end
