video_channel/app/controllers/panel/video/widget/channel_videos_controller.rb

63 lines
2.4 KiB
Ruby
Raw Normal View History

2014-01-14 09:19:31 +00:00
class Panel::Video::Widget::ChannelVideosController < OrbitWidgetController
def initialize
super
@app_title = 'video'
end
# GET /bulletins
# GET /bulletins.xml
def channel_videos
@part = PagePart.find(params[:part_id])
if @part.widget_data_count
@page_num = @part.widget_data_count
else
@page_num = 4
end
if @part.widget_field
@widget_fields = @part.widget_field
else
@widget_fields = []
end
@channel_video = ChannelVideo.find(@part.widget_options['channel_videos']) rescue nil
client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
@client_videos = client.videos_by(:user => @channel_video.channel_name, :per_page => 5)
end
# def bulletins_list_and_pic
# if params[:widget_data_count]
# @page_num = params[:widget_data_count];
# else
# @page_num = 4;
# end
# @title = params[:part_title]
# date_now = Time.now
# if !params[:category_id].blank?
# @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(@page_num )
# @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
# elsif !params[:tag_id].blank?
# @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => params[:tag_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num)
# else
# @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(@page_num )
# end
# get_categorys
# end
# def reload_bulletins
# @selected_tag = Tag.find(params[:tag_id])
# @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => params[:tag_id]).where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort).page(params[:page]).per(5) rescue nil
# end
end