Updated with video widget
This commit is contained in:
parent
eb853f773d
commit
37c91664d3
|
@ -4,9 +4,6 @@ class Panel::Videos::BackEnd::ChannelVideosController < OrbitBackendController
|
|||
|
||||
def index
|
||||
@channel_videos = ChannelVideo.all
|
||||
client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
|
||||
@client_videos = client.videos_by(:user => 'ntuprs', :per_page => 5)
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @videos }
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
class Panel::Announcement::Widget::VideosController < OrbitWidgetController
|
||||
class Panel::Announcement::Widget::ChannelVideosController < OrbitWidgetController
|
||||
include AdminHelper
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'videos'
|
||||
@app_title = 'channel_videos'
|
||||
end
|
||||
|
||||
# GET /bulletins
|
||||
|
@ -9,37 +11,23 @@ class Panel::Announcement::Widget::VideosController < OrbitWidgetController
|
|||
|
||||
def index
|
||||
|
||||
# @part = PagePart.find(params[:part_id])
|
||||
@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_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
|
||||
if @part.widget_field
|
||||
@widget_fields = @part.widget_field
|
||||
else
|
||||
@widget_fields = []
|
||||
end
|
||||
|
||||
# @title = params[:part_title]
|
||||
|
||||
# @widget_style = @part.widget_style
|
||||
|
||||
# @category_id = @part.category
|
||||
|
||||
# date_now = Time.now
|
||||
# if !@category_id.blank?
|
||||
# @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:bulletin_category_id => @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(@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
|
||||
@channel_video = ChannelVideo.find(params[:id])
|
||||
client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
|
||||
@client_videos = client.videos_by(:user => @channel_video.channel_name, :per_page => 5)
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<br/>
|
||||
<h3>YouTube Channel</h3>
|
||||
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<% @client_videos.videos.each do |v| %>
|
||||
<tr class="with_action">
|
||||
<% @video = v.video_id.split(/tag:youtube.com,2008:video:+/).last %>
|
||||
<% @vd = UnvlogIt.new("https://www.youtube.com/watch?v=#{@video}")%>
|
||||
<td><%= @vd.embed_html(200, 150).html_safe %></td>
|
||||
<td><%= @vd.title %></td>
|
||||
<%end%>
|
|
@ -1,3 +1,5 @@
|
|||
zh_tw:
|
||||
video:
|
||||
video: 影片
|
||||
videos: 影片
|
||||
channel: 頻道
|
|
@ -31,6 +31,24 @@ module Videos
|
|||
# # item "bulletins_and_web_links","location.widget.bulletins_and_web_links"
|
||||
# end
|
||||
|
||||
widgets do
|
||||
default_widget do
|
||||
enable ['typeB_style3', 'typeB_style4']
|
||||
# image :image
|
||||
end
|
||||
|
||||
# tags_query 'GalleryTag.all'
|
||||
|
||||
#* customize_widget "albums","gallery.widget.albums",:fields=>[],:style=>[],:options=>{"widget1"=>{"vertical"=>[1, 2], "horizontal"=>[1, 2, 3, 4, 5, 6], "album_id"=>{"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}}}
|
||||
#* customize_widget_options_fields_i18n({"widget1"=>{"vertical"=>"gallery.widget_option.vertical", "horizontal"=>"gallery.widget_option.horizontal", "album_id"=>"gallery.album"}} )
|
||||
|
||||
customize_widget "channel_videos" do
|
||||
widget_i18n "videos.widget.channel_videos"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
side_bar do
|
||||
head_label_i18n 'video.channel',:icon_class=>"icon-facetime-video"
|
||||
available_for [:admin,:guest,:manager,:sub_manager]
|
||||
|
|
Loading…
Reference in New Issue