Updated videos module with widget initiation
This commit is contained in:
parent
75eeec737c
commit
d701d9d6ad
|
@ -13,6 +13,17 @@ class Panel::Videos::BackEnd::ChannelVideosController < OrbitBackendController
|
|||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@video = ChannelVideo.find(params[:id])
|
||||
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
|
||||
format.json { render json: @location }
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@video = ChannelVideo.new
|
||||
end
|
||||
|
|
75
vendor/built_in_modules/videos/app/controllers/panel/videos/widget/channel_videos_controller.rb
vendored
Normal file
75
vendor/built_in_modules/videos/app/controllers/panel/videos/widget/channel_videos_controller.rb
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
class Panel::Announcement::Widget::VideosController < OrbitWidgetController
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'videos'
|
||||
end
|
||||
|
||||
# GET /bulletins
|
||||
# GET /bulletins.xml
|
||||
|
||||
def index
|
||||
|
||||
# @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
|
||||
|
||||
# @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
|
||||
|
||||
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
|
|
@ -1,7 +1,9 @@
|
|||
<div class="control-group">
|
||||
<label class="control-label" for=""><%= t 'title' %></label>
|
||||
<label class="control-label" for=""><%= t "name" %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :channel_name, :class=>"span2", :placeholder => "Channel Name" %>
|
||||
<%= f.fields_for :name_translations do |f| %>
|
||||
<%= f.text_field locale, :class=>'span4', :value => (@location_info.name_translations[locale.to_s] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<% @vd = UnvlogIt.new("https://www.youtube.com/watch?v=#{@video}")%>
|
||||
<td><%= @vd.embed_html(400, 300).html_safe %></td>
|
||||
<td><%= @vd.title %></td>
|
||||
<td><%= link_to 'Show', panel_videos_back_end_channel_video_path(video) %></td>
|
||||
<%if is_manager? %>
|
||||
<td><%= link_to 'Edit', edit_panel_videos_back_end_channel_video_path(video) %></td>
|
||||
<td><%= link_to 'Destroy', panel_videos_back_end_channel_video_path(video), method: :delete , :confirm => t(:sure?) %></td>
|
||||
|
|
7
vendor/built_in_modules/videos/app/views/panel/videos/back_end/channel_videos/show.html.erb
vendored
Normal file
7
vendor/built_in_modules/videos/app/views/panel/videos/back_end/channel_videos/show.html.erb
vendored
Normal file
|
@ -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(400, 300).html_safe %></td>
|
||||
<td><%= @vd.title %></td>
|
||||
<%end%>
|
0
vendor/built_in_modules/videos/app/views/panel/videos/widget/videos/_videos.html.erb
vendored
Normal file
0
vendor/built_in_modules/videos/app/views/panel/videos/widget/videos/_videos.html.erb
vendored
Normal file
|
@ -1,4 +1,5 @@
|
|||
en:
|
||||
video:
|
||||
video: Video
|
||||
videos: Videos
|
||||
videos: Videos
|
||||
channel: Channel
|
|
@ -38,6 +38,12 @@ module Videos
|
|||
|
||||
head_link_path "panel_videos_back_end_videos_path"
|
||||
|
||||
context_link 'video.channel',
|
||||
:link_path=>"panel_videos_back_end_channel_videos_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{:channel_videos=>:index},
|
||||
:available_for => [:manager]
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue