# -*- encoding : utf-8 -*- class Admin::ImageFilesController < ApplicationController before_filter :auth_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.where(:album_id => @album.id).order("created_at DESC") @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(:album_id => params[:album_id], :file =>params[:files]) 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