Sha256: f0db4dee2b6e14ade52ca391223cb7cc8e567de19f5ddc481e49f9da1ddf522a
Contents?: true
Size: 998 Bytes
Versions: 4
Compression:
Stored size: 998 Bytes
Contents
module PhotosManager class PhotosController < ::ApplicationController before_filter :load_event, :except => [ :index ] def index @photo = Photo.find(params[:id]) @photos = @photo.event.photos render :partial => 'carousel', :locals => {:photos => @photos, :current => @photo} end def create @photo = @event.photos.new(:image => params[:Filedata]) @photos = Kaminari.paginate_array(@event.photos).page(params[:page]).per(12) unless @photo.save flash[:error] = "La photo n'a pas pu être téléchargée.".html_safe end render :partial => 'listing', :locals => { :photos => @photos} end def destroy photo = Photo.find(params[:id]) photo.destroy @photos = Kaminari.paginate_array(@event.photos).page(params[:page]).per(12) render :partial => 'listing', :locals => { :photos => @photos } end private def load_event @event = Event.find(params[:event_id]) end end end
Version data entries
4 entries across 4 versions & 1 rubygems