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 5f716287f..5c1f51753 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,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!
- redirect_to panel_videos_back_end_channel_videos_url
+ @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])
- redirect_to panel_videos_back_end_channel_videos_url
+ @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
diff --git a/vendor/built_in_modules/videos/app/controllers/panel/videos/widget/videos_controller.rb b/vendor/built_in_modules/videos/app/controllers/panel/videos/widget/videos_controller.rb
new file mode 100644
index 000000000..ca3f0f040
--- /dev/null
+++ b/vendor/built_in_modules/videos/app/controllers/panel/videos/widget/videos_controller.rb
@@ -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
diff --git a/vendor/built_in_modules/videos/app/models/channel_video.rb b/vendor/built_in_modules/videos/app/models/channel_video.rb
index 56b678a8d..86493e9af 100644
--- a/vendor/built_in_modules/videos/app/models/channel_video.rb
+++ b/vendor/built_in_modules/videos/app/models/channel_video.rb
@@ -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
\ No newline at end of file
diff --git a/vendor/built_in_modules/videos/app/views/panel/videos/back_end/channel_videos/_form.html.erb b/vendor/built_in_modules/videos/app/views/panel/videos/back_end/channel_videos/_form.html.erb
index e5ee7be31..27c3be5da 100644
--- a/vendor/built_in_modules/videos/app/views/panel/videos/back_end/channel_videos/_form.html.erb
+++ b/vendor/built_in_modules/videos/app/views/panel/videos/back_end/channel_videos/_form.html.erb
@@ -1,9 +1,9 @@
+
+
+ | <%= t('channel_name') %> | +<%= t('videos.show') %> | <%if is_manager? %> -<%= t('videos.edit') %> | -<%= t('videos.delete') %> | +<%= t('videos.edit') %> | +<%= t('videos.delete') %> | <% end %>|
---|---|---|---|---|---|---|---|
<%= @vd.embed_html(400, 300).html_safe %> | -<%= @vd.title %> | -<%= link_to 'Show', panel_videos_back_end_channel_video_path(video) %> | +<%= video.channel_name %> | +<%= link_to 'Show Channel Videos', panel_videos_back_end_channel_video_path(video) %> | <%if is_manager? %><%= link_to 'Edit', edit_panel_videos_back_end_channel_video_path(video) %> | -<%= link_to 'Destroy', panel_videos_back_end_channel_video_path(video), method: :delete , :confirm => t(:sure?) %> | - <%end%> +<%= link_to 'Delete Channel', panel_videos_back_end_channel_video_path(video), method: :delete , :confirm => t(:sure?) %> | + <% end %>