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

class Admin::ExternalLinksController < ApplicationController

	before_filter :authenticate_admin!

	layout "admin"


	def cible
		@external_links = ExternalLink.all
		
		render :layout => false
	end
	
	
	def new
		@external_link = ExternalLink.new

	end


	def edit
		@external_link = ExternalLink.find(params[:id])
		
	end


	def create
		@external_link = ExternalLink.new(params[:external_link])


			if @external_link.save
				flash[:notice] = "Le lien a été ajouté avec succès."
		
			else
				render :action => "new" 
				
			end
	
	end


	def update
		@external_link = ExternalLink.find(params[:id])
	
		if @external_link.update_attributes(params[:external_link])
			flash[:notice] = "Le lien a été modifié avec succès."
			
		else
			render :action => "edit" 
			
		end

	end


	def destroy
		@external_link = ExternalLink.find(params[:id])
		@external_link.destroy

	end
	
end
