Updated video cleaned up the ui
This commit is contained in:
parent
d701d9d6ad
commit
eb853f773d
|
@ -3,7 +3,7 @@ class Panel::Videos::BackEnd::ChannelVideosController < OrbitBackendController
|
|||
before_filter :force_order_for_user,:except => [:index]
|
||||
|
||||
def index
|
||||
@videos = ChannelVideo.all
|
||||
@channel_videos = ChannelVideo.all
|
||||
client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
|
||||
@client_videos = client.videos_by(:user => 'ntuprs', :per_page => 5)
|
||||
|
||||
|
@ -14,9 +14,9 @@ class Panel::Videos::BackEnd::ChannelVideosController < OrbitBackendController
|
|||
end
|
||||
|
||||
def show
|
||||
@video = ChannelVideo.find(params[:id])
|
||||
@channel_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)
|
||||
@client_videos = client.videos_by(:user => @channel_video.channel_name, :per_page => 5)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
@ -25,24 +25,36 @@ class Panel::Videos::BackEnd::ChannelVideosController < OrbitBackendController
|
|||
end
|
||||
|
||||
def new
|
||||
@video = ChannelVideo.new
|
||||
@channel_video = ChannelVideo.new
|
||||
end
|
||||
|
||||
def edit
|
||||
@channel_video = ChannelVideo.find(params[:id])
|
||||
end
|
||||
|
||||
def create
|
||||
@video = ChannelVideo.new(params[:video])
|
||||
@video.save!
|
||||
@channel_video = ChannelVideo.new(params[:channel_video])
|
||||
|
||||
if @channel_video.save
|
||||
redirect_to panel_videos_back_end_channel_videos_url
|
||||
else
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@video = ChannelVideo.find(params[:id])
|
||||
@video.update_attributes(params[:video])
|
||||
@channel_video = ChannelVideo.find(params[:id])
|
||||
|
||||
if @channel_video.update_attributes(params[:channel_video])
|
||||
redirect_to panel_videos_back_end_channel_videos_url
|
||||
else
|
||||
render 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@video = ChannelVideo.find(params[:id])
|
||||
@video.destroy
|
||||
@channel_video = ChannelVideo.find(params[:id])
|
||||
@channel_video.destroy
|
||||
redirect_to panel_videos_back_end_channel_videos_url
|
||||
|
||||
end
|
||||
|
|
75
vendor/built_in_modules/videos/app/controllers/panel/videos/widget/videos_controller.rb
vendored
Normal file
75
vendor/built_in_modules/videos/app/controllers/panel/videos/widget/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
|
|
@ -2,5 +2,9 @@ class ChannelVideo
|
|||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
attr_accessible :channel_name
|
||||
|
||||
field :channel_name
|
||||
|
||||
validates_presence_of :channel_name
|
||||
end
|
|
@ -1,9 +1,9 @@
|
|||
<br/>
|
||||
<h2>YouTube Channel</h2>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for=""><%= t "name" %></label>
|
||||
<label class="control-label" for=""><%= t "Enter the Name of your YouTube channel" %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :name_translations do |f| %>
|
||||
<%= f.text_field locale, :class=>'span4', :value => (@location_info.name_translations[locale.to_s] rescue nil) %>
|
||||
<% end %>
|
||||
<%= f.text_field :channel_name, :class=>'span4', :placeholder => 'Channel Name'%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<%= form_for @video, :url=> panel_videos_back_end_channel_video_path(@video), :html => { :class=>"form-horizontal"} do |f| %>
|
||||
<%= form_for @channel_video, :url => panel_videos_back_end_channel_video_path, :method => :put, :html => { :class=>"form-horizontal"} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
|
@ -1,31 +1,30 @@
|
|||
<br/>
|
||||
<h3>YouTube Channel</h3>
|
||||
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"></th>
|
||||
<th class="span4"><%= t('channel_name') %></th>
|
||||
<th class="span4"><%= t('videos.show') %></th>
|
||||
<%if is_manager? %>
|
||||
<th class="span1"><%= t('videos.edit') %></th>
|
||||
<th class="span1"><%= t('videos.delete') %></th>
|
||||
<th class="span4"><%= t('videos.edit') %></th>
|
||||
<th class="span4"><%= t('videos.delete') %></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_locations" class="sort-holder">
|
||||
<% @videos.each do |video| %>
|
||||
<% @client_videos.videos.each do |v| %>
|
||||
<% @channel_videos.each do |video| %>
|
||||
<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>
|
||||
<td><%= link_to 'Show', panel_videos_back_end_channel_video_path(video) %></td>
|
||||
<td><%= video.channel_name %></td>
|
||||
<td><%= link_to 'Show Channel Videos', 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>
|
||||
<%end%>
|
||||
<td><%= link_to 'Delete Channel', panel_videos_back_end_channel_video_path(video), method: :delete , :confirm => t(:sure?) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<%end%>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%if is_manager? %>
|
||||
<td><%= link_to 'New', new_panel_videos_back_end_channel_video_path, :class => "btn btn-primary", :id=>"create_event_btn", :ref=>"add-btn" %></td>
|
||||
<%= link_to 'New', new_panel_videos_back_end_channel_video_path, :class => "btn btn-primary pull-right", :id=>"create_event_btn", :ref=>"add-btn" %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<%= form_for @video, :url=> panel_videos_back_end_channel_videos_path, :html => { :class=>"form-horizontal"} do |f| %>
|
||||
<%= form_for @channel_video, :url => panel_videos_back_end_channel_videos_path, :html => { :class=>"form-horizontal"} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
|
|
@ -32,14 +32,14 @@ module Videos
|
|||
# end
|
||||
|
||||
side_bar do
|
||||
head_label_i18n 'video.video',:icon_class=>"icon-facetime-video"
|
||||
head_label_i18n 'video.channel',:icon_class=>"icon-facetime-video"
|
||||
available_for [:admin,:guest,:manager,:sub_manager]
|
||||
active_for_controllers ({:private=>['videos']})
|
||||
|
||||
head_link_path "panel_videos_back_end_videos_path"
|
||||
head_link_path "panel_videos_back_end_channel_videos_path"
|
||||
|
||||
context_link 'video.channel',
|
||||
:link_path=>"panel_videos_back_end_channel_videos_path" ,
|
||||
context_link 'video.videos',
|
||||
:link_path=>"panel_videos_back_end_videos_path" ,
|
||||
:priority=>1,
|
||||
:active_for_action=>{:channel_videos=>:index},
|
||||
:available_for => [:manager]
|
||||
|
|
Loading…
Reference in New Issue