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

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

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

  end

  def show
    @s_site = SSite.find(params[:id])

  end

  def new
    @s_site = SSite.new
  
  end

  def edit
    @s_site = SSite.find(params[:id])
    
  end

  def create
    @s_site = SSite.new(params.require(:s_site).permit!)

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

  end


  def update
    @s_site = SSite.find(params[:id])


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


  def destroy
    @s_site = SSite.find(params[:id])
    @s_site.destroy
    
  end
end
