Class GalleryController
In: app/controllers/gallery_controller.rb
Parent: ApplicationController

Methods

channel   show  

Public Instance methods

[Source]

    # File app/controllers/gallery_controller.rb, line 10
10:   def channel
11:     @gallery = Gallery.new
12:     
13:     if params[:id]
14:       @channel = Category.find(params[:id])
15:     elsif params[:channel]
16:       if @dept = Department.find_by_label(params[:channel])
17:         @channel = @gallery.department_channel(@dept)
18:       end
19:     end
20:     
21:     if @channel
22:       @title = @channel.name
23:       # @albums = @channel.albums.paginate(:conditions => "album_photos_count>0", :order => "featured DESC, created_at DESC", :limit => 7)
24:       
25:       @albums = Album.published.tagged_with(@channel.tags.private.collect {|t| t.name_es}).paginate :page => params[:p], :per_page => 6,
26:         :conditions => "album_photos_count>0", 
27:         :order => "featured DESC, created_at DESC"
28: 
29:       @featured_album = @albums.first
30:       @featured_photos = @featured_album.photos.ordered_by_title.paginate :page => params[:page], :per_page => 6, 
31:         :conditions => ["cover_photo=?", false] if @featured_album
32:         
33:       respond_to do |format|
34:         format.html
35:         format.js {
36:           render :update do |page|
37:             if params[:page]
38:               page.replace 'thumbnails', :partial => '/albums/thumbnails', :locals => {:photos => @featured_photos}
39:             elsif params[:p]
40:               page.replace "channel_#{@channel.id}", :partial => "/gallery/channel_albums", :locals => {:albums => @albums, :channel => @channel}
41:             end
42:           end
43:         }
44:       end
45:       
46:     else
47:       flash[:notice] = t('gallery.does_not_exist')
48:       redirect_to gallery_path and return
49:     end
50:     
51:   end

[Source]

   # File app/controllers/gallery_controller.rb, line 2
2:   def show
3:     @gallery = Gallery.new
4:     
5:     @title = t('gallery.gallery')
6:     @featured_albums = Album.get_featured
7:     @photos = Photo.published.find(:all, :limit => 20, :order => "created_at DESC")
8:   end

[Validate]