# -*- encoding : utf-8 -*-
class Admin::FileFoldersController < ApplicationController
	before_filter :authenticate_admin!
	load_and_authorize_resource
	

	def index
		@file_folders = FileFolder.all(:order => :name)
	end

	def new
		@file_folder = FileFolder.new()
	end

	def create
		@file_folder = FileFolder.new(params[:file_folder])
		@file_folder_create = true
		
		if @file_folder.save
			@file_folders = FileFolder.all(:order => :name)
		else
			render :action => :new
		
		end
	end

	def edit
		@file_folder = FileFolder.find(params[:id])	
	end

	def update
		@file_folder = FileFolder.find(params[:id])
		@file_folder_update = true
		
		if @file_folder.update_attributes(params[:file_folder])
			@file_folders = FileFolder.all(:order => :name)
		else
			render :action => :edit
		
		end
	end

	def destroy
		@file_folder = FileFolder.find(params[:id])
		if @file_folder.id != 1
			@file_folder.delete
		end
	end

end
