# -*- encoding : utf-8 -*- class Admin::ImageFilesController < ApplicationController before_filter :authenticate_admin! layout "admin" def index params[:album_id] = params[:album_id] || 1 @album = Album.find(params[:album_id]) @albums = Album.all(:order => :name) @image_files = ImageFile.all(:order => "created_at DESC", :conditions => {:album_id => @album.id}) @image_file = ImageFile.new(:album_id => @album.id) if request.xhr? render :layout => false end end def new end def edit end def create @image_file_create = true @image_file = ImageFile.new(:name => params[:image_file][:name], :album_id => params[:image_file][:album_id], :file =>params[:image_file][:file][0]) if @image_file.save else end end def update @image_file = ImageFile.find(params[:id]) if @image_file.update_attributes(params[:image_file]) else end end def destroy @image_file = ImageFile.find(params[:id]) @image_file.destroy flash[:notice] = "L'image à bien été supprimée." end def show @image_file = ImageFile.find(params[:id]) end def rotate deg = params[:direction] == "right" ? -90 : 90 @image_file = ImageFile.find(params[:id]) @image_file.rotate(deg) end end