diff --git a/vendor/built_in_modules/videos/app/controllers/panel/videos/back_end/channel_videos_controller.rb b/vendor/built_in_modules/videos/app/controllers/panel/videos/back_end/channel_videos_controller.rb index 5c1f51753..d63ca0abf 100644 --- a/vendor/built_in_modules/videos/app/controllers/panel/videos/back_end/channel_videos_controller.rb +++ b/vendor/built_in_modules/videos/app/controllers/panel/videos/back_end/channel_videos_controller.rb @@ -3,10 +3,7 @@ class Panel::Videos::BackEnd::ChannelVideosController < OrbitBackendController before_filter :force_order_for_user,:except => [:index] 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) - + @channel_videos = ChannelVideo.all respond_to do |format| format.html # new.html.erb format.json { render json: @videos } diff --git a/vendor/built_in_modules/videos/app/controllers/panel/videos/widget/channel_videos_controller.rb b/vendor/built_in_modules/videos/app/controllers/panel/videos/widget/channel_videos_controller.rb index ca3f0f040..4eb60b59d 100644 --- a/vendor/built_in_modules/videos/app/controllers/panel/videos/widget/channel_videos_controller.rb +++ b/vendor/built_in_modules/videos/app/controllers/panel/videos/widget/channel_videos_controller.rb @@ -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,38 +11,24 @@ 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 - - # @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 + if @part.widget_field + @widget_fields = @part.widget_field + else + @widget_fields = [] + end + + @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) - # get_categorys - end # def bulletins_list_and_pic diff --git a/vendor/built_in_modules/videos/app/views/panel/videos/back_end/channel_videos/index.html.erb b/vendor/built_in_modules/videos/app/views/panel/videos/back_end/channel_videos/index.html.erb index 1a36c4ffe..ccae88719 100644 --- a/vendor/built_in_modules/videos/app/views/panel/videos/back_end/channel_videos/index.html.erb +++ b/vendor/built_in_modules/videos/app/views/panel/videos/back_end/channel_videos/index.html.erb @@ -1,6 +1,5 @@

YouTube Channel

- diff --git a/vendor/built_in_modules/videos/app/views/panel/videos/widget/videos/_videos.html.erb b/vendor/built_in_modules/videos/app/views/panel/videos/widget/videos/_videos.html.erb index e69de29bb..2eed661c5 100644 --- a/vendor/built_in_modules/videos/app/views/panel/videos/widget/videos/_videos.html.erb +++ b/vendor/built_in_modules/videos/app/views/panel/videos/widget/videos/_videos.html.erb @@ -0,0 +1,7 @@ +<% @client_videos.videos.each do |v| %> + + <% @video = v.video_id.split(/tag:youtube.com,2008:video:+/).last %> + <% @vd = UnvlogIt.new("https://www.youtube.com/watch?v=#{@video}")%> + + + <%end%> \ No newline at end of file diff --git a/vendor/built_in_modules/videos/config/locales/zh_tw.yml b/vendor/built_in_modules/videos/config/locales/zh_tw.yml index df3d3abe5..7d1c0da58 100644 --- a/vendor/built_in_modules/videos/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/videos/config/locales/zh_tw.yml @@ -1,3 +1,5 @@ zh_tw: video: - video: 影片 \ No newline at end of file + video: 影片 + videos: 影片 + channel: 頻道 \ No newline at end of file diff --git a/vendor/built_in_modules/videos/init.rb b/vendor/built_in_modules/videos/init.rb index 560f0d90f..d672502b2 100644 --- a/vendor/built_in_modules/videos/init.rb +++ b/vendor/built_in_modules/videos/init.rb @@ -30,6 +30,24 @@ module Videos # # item "index","location.widget.index",:default_template=>true,:fields=>["title","category","postdate"] # # 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"
<%= @vd.embed_html(200, 150).html_safe %><%= @vd.title %>