| Class | AlbumsController |
| In: |
app/controllers/albums_controller.rb
|
| Parent: | ApplicationController |
Índice de álbums de la fototeca
# File app/controllers/albums_controller.rb, line 4 4: def index 5: # @title = t('photos.fototeca') 6: # @albums = Album.published.paginate :page => params[:page], :per_page => 15, :order => "title_es" 7: headers["Status"] = "301 Moved Permanently" 8: redirect_to gallery_path 9: end
Vista de un album de la fototeca
# File app/controllers/albums_controller.rb, line 12
12: def show
13: @album = Album.find(params[:id])
14: @title_for_head = @album.title
15:
16: @photos = @album.photos.ordered_by_title.paginate :page => params[:page], :per_page => 6,
17: :conditions => ["cover_photo=?", false]
18:
19: if params[:photo_id] && @photo = @album.photos.find(params[:photo_id])
20: @photo_id = params[:photo_id]
21: unless @photos.collect(&:id).include?(@photo_id.to_i)
22: @photos.pop
23: @photos << @photo
24: end
25: end
26:
27: respond_to do |format|
28: format.html
29: format.js {
30: render :update do |page|
31: page.replace 'thumbnails', :partial => '/albums/thumbnails', :locals => {:photos => @photos}
32: end
33: }
34: end
35:
36: end