class VideosController

Controlador para la WebTV.

Public Instance Methods

cat() click to toggle source
# File app/controllers/videos_controller.rb, line 51
def cat
  @categories = Video.categories
  @category = Category.find(params[:id])
  @title = @category.name
  @videos = @category.videos.paginate(:per_page => 12, :order => "published_at DESC, matching_tag_counter DESC", :page  => params[:page] || 1)
end
index() click to toggle source
# File app/controllers/videos_controller.rb, line 28
def index
  prepare_videos(@context, request.xhr?)
  
  respond_to do |format|
    format.html do
      if request.xhr?
        render :partial => '/shared/list_items', :locals => {:items => @videos, :type => 'video'}, :layout => false
      else
        render
      end
    end
  end
  
end
podcast() click to toggle source
# File app/controllers/videos_controller.rb, line 82
def podcast
  @videos = Video.published.translated.find :all, :limit => 100, :order => "published_at DESC"
  # respond_to do |format|
  #   format.any(:html, :xml) {logger.info "ZZZZZZZZZZZ";render :action => "podcast.xml", :layout => false, :content_type => 'application/xml'}
  # end
  
  render :action => "podcast.xml", :layout => false, :content_type => 'application/xml'
end
show() click to toggle source

Página de un video

# File app/controllers/videos_controller.rb, line 59
def show
  begin
    @video = Video.published.find(params[:id])
  rescue ActiveRecord::RecordNotFound
    if can_edit?("videos")
      @video = Video.find(params[:id])
    else
      raise ActiveRecord::RecordNotFound
    end
  end

  @page_title_for_head = @video.title
  @title = t('videos.web_tv')
  
  # Comments
  @parent = @video
  @comments = @video.comments.approved.paginate :page => params[:page], :per_page => 25
  
  @related_videos = (Video.published.translated.find_tagged_with(@video.tag_list, :order => "matching_tag_counter DESC, published_at DESC ") - [@video])[0..10]
      
end
summary() click to toggle source
# File app/controllers/videos_controller.rb, line 43
def summary
  @featured_video = Video.published.featured
  @featured_albums = Album.published.with_photos.featured.find(:all, :limit => 2)
  # @featured_photo1 = featured_albums[0].cover_photo
  # @featured_photo2 = featured_albums[1].cover_photo
  render :layout => !request.xhr?
end