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

class Admin::HomeSlidersController < ApplicationController
  layout "admin"
  before_filter :auth_admin

  def index
    @home_sliders = HomeSlider.all

   
  end

  def show
    @home_slider = HomeSlider.find(params[:id])

  end

  def new
    
    
		@home_slider = HomeSlider.new
    

  end

 

  def edit
  
    
    @home_slider = HomeSlider.find(params[:id])
  end

  def create
    @home_slider = HomeSlider.new(params.require(:home_slider).permit!)


    if @home_slider.save
     redirect_to admin_home_sliders_url, notice: 'La pétition a été crée.' 
      
    else
      render action: "new"
 
    end

  end


  def update
    @home_slider = HomeSlider.find(params[:id])


    if @home_slider.update_attributes(params.require(:home_slider).permit!)
      redirect_to admin_home_sliders_url, notice: 'Les infos sur la pétition ont été mise à jour.' 
     
    else
     render action: "edit" 
      
    end
      
  end


  def destroy
    @home_slider = HomeSlider.find(params[:id])
    @home_slider.destroy
    
    redirect_to admin_home_sliders_url

  end
end
