Orbit Video Module
This commit is contained in:
commit
7d3966d308
|
@ -0,0 +1,6 @@
|
||||||
|
.bundle/
|
||||||
|
log/*.log
|
||||||
|
pkg/
|
||||||
|
test/dummy/db/*.sqlite3
|
||||||
|
test/dummy/log/*.log
|
||||||
|
test/dummy/tmp/
|
|
@ -0,0 +1,17 @@
|
||||||
|
source "http://rubygems.org"
|
||||||
|
|
||||||
|
# Declare your gem's dependencies in location.gemspec.
|
||||||
|
# Bundler will treat runtime dependencies like base dependencies, and
|
||||||
|
# development dependencies will be added by default to the :development group.
|
||||||
|
gemspec
|
||||||
|
|
||||||
|
# jquery-rails is used by the dummy application
|
||||||
|
gem "jquery-rails"
|
||||||
|
|
||||||
|
# Declare any dependencies that are still in development here instead of in
|
||||||
|
# your gemspec. These might include edge Rails or gems from your path or
|
||||||
|
# Git. Remember to move these dependencies to your gemspec before releasing
|
||||||
|
# your gem to rubygems.org.
|
||||||
|
|
||||||
|
# To use debugger
|
||||||
|
# gem 'ruby-debug19', :require => 'ruby-debug'
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright 2012 YOURNAME
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,3 @@
|
||||||
|
= Location
|
||||||
|
|
||||||
|
This project rocks and uses MIT-LICENSE.
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env rake
|
||||||
|
begin
|
||||||
|
require 'bundler/setup'
|
||||||
|
rescue LoadError
|
||||||
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
||||||
|
end
|
||||||
|
begin
|
||||||
|
require 'rdoc/task'
|
||||||
|
rescue LoadError
|
||||||
|
require 'rdoc/rdoc'
|
||||||
|
require 'rake/rdoctask'
|
||||||
|
RDoc::Task = Rake::RDocTask
|
||||||
|
end
|
||||||
|
|
||||||
|
RDoc::Task.new(:rdoc) do |rdoc|
|
||||||
|
rdoc.rdoc_dir = 'rdoc'
|
||||||
|
rdoc.title = 'Location'
|
||||||
|
rdoc.options << '--line-numbers'
|
||||||
|
rdoc.rdoc_files.include('README.rdoc')
|
||||||
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||||
|
end
|
||||||
|
|
||||||
|
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||||
|
load 'rails/tasks/engine.rake'
|
||||||
|
|
||||||
|
|
||||||
|
Bundler::GemHelper.install_tasks
|
||||||
|
|
||||||
|
require 'rake/testtask'
|
||||||
|
|
||||||
|
Rake::TestTask.new(:test) do |t|
|
||||||
|
t.libs << 'lib'
|
||||||
|
t.libs << 'test'
|
||||||
|
t.pattern = 'test/**/*_test.rb'
|
||||||
|
t.verbose = false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
task :default => :test
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
// All this logic will automatically be available in application.js.
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
// All this logic will automatically be available in application.js.
|
|
@ -0,0 +1,4 @@
|
||||||
|
/*
|
||||||
|
Place all the styles related to the matching controller here.
|
||||||
|
They will automatically be included in application.css.
|
||||||
|
*/
|
|
@ -0,0 +1,4 @@
|
||||||
|
/*
|
||||||
|
Place all the styles related to the matching controller here.
|
||||||
|
They will automatically be included in application.css.
|
||||||
|
*/
|
|
@ -0,0 +1,61 @@
|
||||||
|
class Panel::Video::BackEnd::ChannelVideosController < OrbitBackendController
|
||||||
|
# before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :delete]
|
||||||
|
# before_filter :force_order_for_user,:except => [:index]
|
||||||
|
open_for_admin
|
||||||
|
open_for_manager
|
||||||
|
open_for_sub_manager
|
||||||
|
|
||||||
|
def index
|
||||||
|
@channel_videos = ChannelVideo.all
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # new.html.erb
|
||||||
|
format.json { render json: @videos }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@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)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.json { render json: @location }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@channel_video = ChannelVideo.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@channel_video = ChannelVideo.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@channel_video = ChannelVideo.new(params[:channel_video])
|
||||||
|
|
||||||
|
if @channel_video.save
|
||||||
|
redirect_to panel_video_back_end_channel_videos_url
|
||||||
|
else
|
||||||
|
render 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@channel_video = ChannelVideo.find(params[:id])
|
||||||
|
|
||||||
|
if @channel_video.update_attributes(params[:channel_video])
|
||||||
|
redirect_to panel_video_back_end_channel_videos_url
|
||||||
|
else
|
||||||
|
render 'edit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@channel_video = ChannelVideo.find(params[:id])
|
||||||
|
@channel_video.destroy
|
||||||
|
redirect_to panel_video_back_end_channel_videos_url
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,74 @@
|
||||||
|
class Panel::Video::BackEnd::VideosController < OrbitBackendController
|
||||||
|
|
||||||
|
#before_filter :clean_values, :only => [:create, :update]
|
||||||
|
|
||||||
|
before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :delete]
|
||||||
|
before_filter :force_order_for_user,:except => [:get_videos,:index]
|
||||||
|
# before_filter :for_app_sub_manager,:except => [:index, :new, :edit, :delete, :get_videos]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@videos = Video.all
|
||||||
|
@client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # new.html.erb
|
||||||
|
format.json { render json: @videos }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@video = Video.new
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # new.html.erb
|
||||||
|
format.json { render json: @video }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@video = Video.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@video = Video.find(params[:id])
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.json { render json: @video }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@video = Video.new(params[:video])
|
||||||
|
@video.save!
|
||||||
|
redirect_to panel_videos_back_end_videos_url
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@video = Video.find(params[:id])
|
||||||
|
@video.update_attributes(params[:video])
|
||||||
|
redirect_to panel_videos_back_end_videos_url
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@video = Video.find(params[:id])
|
||||||
|
@video.destroy
|
||||||
|
redirect_to panel_videos_back_end_videos_url
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_videos
|
||||||
|
videos = Video.all
|
||||||
|
@data = Array.new
|
||||||
|
|
||||||
|
videos.each do |video|
|
||||||
|
@data << { title: video.title,
|
||||||
|
url: video.url,
|
||||||
|
description: video.description }
|
||||||
|
end
|
||||||
|
|
||||||
|
#print readable json
|
||||||
|
render :json => JSON.pretty_generate({video: @data})
|
||||||
|
|
||||||
|
#render :json => {video: @data}.to_json
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,26 @@
|
||||||
|
class Panel::Video::FrontEnd::ChannelVideosController < OrbitWidgetController
|
||||||
|
def initialize
|
||||||
|
super
|
||||||
|
@app_title = 'video'
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@item = Page.find(params[:page_id]) rescue nil
|
||||||
|
if @item
|
||||||
|
if @item.frontend_data_count
|
||||||
|
@page_num = @item.frontend_data_count
|
||||||
|
else
|
||||||
|
@page_num = 15
|
||||||
|
end
|
||||||
|
@frontend_style = @item.frontend_style
|
||||||
|
end
|
||||||
|
@item = Page.find(params[:page_id]) rescue nil
|
||||||
|
@channel_video = ChannelVideo.first rescue nil
|
||||||
|
client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
|
||||||
|
@client_videos = client.videos_by(:user => @channel_video.channel_name, :per_page => 5)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,62 @@
|
||||||
|
class Panel::Video::Widget::ChannelVideosController < OrbitWidgetController
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
super
|
||||||
|
@app_title = 'video'
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /bulletins
|
||||||
|
# GET /bulletins.xml
|
||||||
|
|
||||||
|
def channel_videos
|
||||||
|
@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
|
||||||
|
|
||||||
|
@channel_video = ChannelVideo.find(@part.widget_options['channel_videos']) rescue nil
|
||||||
|
client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
|
||||||
|
@client_videos = client.videos_by(:user => @channel_video.channel_name, :per_page => 5)
|
||||||
|
|
||||||
|
|
||||||
|
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
|
|
@ -0,0 +1,2 @@
|
||||||
|
module Panel::Locations::BackEnd::VideosHelper
|
||||||
|
end
|
|
@ -0,0 +1,10 @@
|
||||||
|
class ChannelVideo
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
attr_accessible :channel_name
|
||||||
|
|
||||||
|
field :channel_name
|
||||||
|
|
||||||
|
validates_presence_of :channel_name
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
class Video
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :title
|
||||||
|
field :description
|
||||||
|
field :url
|
||||||
|
end
|
|
@ -0,0 +1,61 @@
|
||||||
|
class LocationsUploader < CarrierWave::Uploader::Base
|
||||||
|
|
||||||
|
# Include RMagick or ImageScience support:
|
||||||
|
# include CarrierWave::RMagick
|
||||||
|
# include CarrierWave::ImageScience
|
||||||
|
include CarrierWave::MiniMagick
|
||||||
|
|
||||||
|
# Choose what kind of storage to use for this uploader:
|
||||||
|
# storage :file
|
||||||
|
# storage :s3
|
||||||
|
|
||||||
|
# Override the directory where uploaded files will be stored.
|
||||||
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
|
def store_dir
|
||||||
|
"location/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Provide a default URL as a default if there hasn't been a file uploaded:
|
||||||
|
# def default_url
|
||||||
|
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Process files as they are uploaded:
|
||||||
|
# process :scale => [200, 300]
|
||||||
|
#
|
||||||
|
# def scale(width, height)
|
||||||
|
# # do something
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Create different versions of your uploaded files:
|
||||||
|
# version :thumb do
|
||||||
|
# process :scale => [50, 50]
|
||||||
|
# end
|
||||||
|
|
||||||
|
version :thumb do
|
||||||
|
process :resize_to_fill => [150, 120]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add a white list of extensions which are allowed to be uploaded.
|
||||||
|
# For images you might use something like this:
|
||||||
|
# def extension_white_list
|
||||||
|
# %w(jpg jpeg gif png)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Override the filename of the uploaded files:
|
||||||
|
# def filename
|
||||||
|
# "something.jpg" if original_filename
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def manipulate!
|
||||||
|
# raise current_path.inspect
|
||||||
|
# image = ::MiniMagick::Image.open(current_path)
|
||||||
|
# image = yield(image)
|
||||||
|
# image.write(current_path)
|
||||||
|
# ::MiniMagick::Image.open(current_path)
|
||||||
|
# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e
|
||||||
|
# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}")
|
||||||
|
# end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<br/>
|
||||||
|
<h2>YouTube Channel</h2>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for=""><%= t "Enter the Name of your YouTube channel" %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :channel_name, :class=>'span4', :placeholder => 'Channel Name'%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.submit t("submit"), :class=>"btn" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @channel_video, :url => panel_video_back_end_channel_video_path, :method => :put, :html => { :class=>"form-horizontal"} do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<br/>
|
||||||
|
<h3>YouTube Channel</h3>
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="span4"><%= t('channel_name') %></th>
|
||||||
|
<th class="span4"><%= t('videos.show') %></th>
|
||||||
|
<%if is_manager? %>
|
||||||
|
<th class="span4"><%= t('videos.edit') %></th>
|
||||||
|
<th class="span4"><%= t('videos.delete') %></th>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tbody_locations" class="sort-holder">
|
||||||
|
<% @channel_videos.each do |video| %>
|
||||||
|
<tr class="with_action">
|
||||||
|
<td><%= video.channel_name %></td>
|
||||||
|
<td><%= link_to 'Show Channel Videos', panel_video_back_end_channel_video_path(video) %></td>
|
||||||
|
<%if is_manager? %>
|
||||||
|
<td><%= link_to 'Edit', edit_panel_video_back_end_channel_video_path(video) %></td>
|
||||||
|
<td><%= link_to 'Delete Channel', panel_video_back_end_channel_video_path(video), method: :delete , :confirm => t(:sure?) %></td>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<%if is_manager? %>
|
||||||
|
<%= link_to 'New', new_panel_video_back_end_channel_video_path, :class => "btn btn-primary pull-right", :id=>"create_event_btn", :ref=>"add-btn" %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @channel_video, :url => panel_video_back_end_channel_videos_path, :html => { :class=>"form-horizontal"} do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -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,0 +1,26 @@
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for=""><%= t 'title' %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :title, :class=>"span2", :placeholder => "Title" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for=""><%= t 'url' %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :url, :class=>"span2", :placeholder => "URL" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for=""><%= t 'description' %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.fields_for :description_translations do |f| %>
|
||||||
|
<%= f.text_area locale, :class=>'span4', :cols=>"30", :row=>"5", :value => (@video.description_translations[locale.to_s] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.submit t("submit"), :class=>"btn" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<%= form_for @video, :url=> panel_videos_back_end_video_path(@video), :html => { :class=>"form-horizontal"} do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="span1"></th>
|
||||||
|
<th class="span1"><%= t('videos.title') %></th>
|
||||||
|
<th class="span3"><%= t('videos.description') %></th>
|
||||||
|
<%if is_manager? %>
|
||||||
|
<th class="span1"><%= t('videos.edit') %></th>
|
||||||
|
<th class="span1"><%= t('videos.delete') %></th>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tbody_locations" class="sort-holder">
|
||||||
|
<% @videos.each do |video| %>
|
||||||
|
<tr class="with_action">
|
||||||
|
<% video_display = UnvlogIt.new(video.url)%>
|
||||||
|
<td><%= video_display.embed_html(400, 300).html_safe %></td>
|
||||||
|
<td><%= video.title %></td>
|
||||||
|
<% @client_videos = @client.videos_by(:user => 'ntuprs', :per_page => 5) %>
|
||||||
|
|
||||||
|
<td><% @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}")%><%= vd.embed_html(200, 150).html_safe %><br/><br/><br/> <% end %></td>
|
||||||
|
<%if is_manager? %>
|
||||||
|
<td><%= link_to 'Edit', edit_panel_videos_back_end_video_path(video) %></td>
|
||||||
|
<td><%= link_to 'Destroy', panel_videos_back_end_video_path(video), method: :delete , :confirm => t(:sure?) %></td>
|
||||||
|
<%end%>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<%if is_manager? %>
|
||||||
|
<td><%= link_to 'New', new_panel_videos_back_end_video_path, :class => "btn btn-primary", :id=>"create_event_btn", :ref=>"add-btn" %></td>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @video, :url=> panel_videos_back_end_videos_path, :html => { :class=>"form-horizontal"} do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<div class="video-widget">
|
||||||
|
<h3 class="h3">Videos</h3>
|
||||||
|
<ul class="video-list">
|
||||||
|
<% @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}")%>
|
||||||
|
<li>
|
||||||
|
<p class="video-title"><%= @vd.title %></p>
|
||||||
|
<div class="video">
|
||||||
|
<%=link_to image_tag(@vd.thumbnail, :size => '200x150'), "https://www.youtube.com/watch?v=#{@video}", :class => "cover", :target => "blank" %>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<%end%>
|
||||||
|
</div>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<h4>Videos</h4>
|
||||||
|
<ul class="video-list">
|
||||||
|
|
||||||
|
<% @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}")%>
|
||||||
|
<li><p class="video-title"><%= @vd.title %>
|
||||||
|
<div class="video"><%= @vd.embed_html(200, 150).html_safe %></div></li>
|
||||||
|
<%end%>
|
|
@ -0,0 +1,5 @@
|
||||||
|
en:
|
||||||
|
video:
|
||||||
|
video: Video
|
||||||
|
videos: Videos
|
||||||
|
channel: Channel
|
|
@ -0,0 +1,5 @@
|
||||||
|
zh_tw:
|
||||||
|
video:
|
||||||
|
video: 影片
|
||||||
|
videos: 影片
|
||||||
|
channel: 頻道
|
|
@ -0,0 +1,20 @@
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
namespace :panel do
|
||||||
|
namespace :video do
|
||||||
|
namespace :back_end do
|
||||||
|
match "videos/get_videos" => "videos#get_videos"
|
||||||
|
resources :videos
|
||||||
|
resources :channel_videos
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace :front_end do
|
||||||
|
resources :channel_videos
|
||||||
|
# match "/channel_videos" => "channel_videos#channel_videos", :via => :get
|
||||||
|
end
|
||||||
|
namespace :widget do
|
||||||
|
#resources :channel_videos
|
||||||
|
match "/channel_videos" => "channel_videos#channel_videos", :via => :get
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# desc "Explaining what the task does"
|
||||||
|
# task :location do
|
||||||
|
# # Task goes here
|
||||||
|
# end
|
|
@ -0,0 +1,47 @@
|
||||||
|
module Videos
|
||||||
|
class Engine < Rails::Engine
|
||||||
|
initializer "video" do
|
||||||
|
OrbitApp.registration "Video",:type=> 'ModuleApp' do
|
||||||
|
module_label 'video.video'
|
||||||
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
|
|
||||||
|
version "0.1"
|
||||||
|
organization "Rulingcom"
|
||||||
|
author "RD dep"
|
||||||
|
intro "I am intro"
|
||||||
|
|
||||||
|
front_end do
|
||||||
|
app_page 'channel_videos' do
|
||||||
|
frontend_i18n "video.front_end.channel_videos"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
authorizable
|
||||||
|
|
||||||
|
widgets do
|
||||||
|
customize_widget "channel_videos" do
|
||||||
|
widget_i18n "videos.widget.channel_videos"
|
||||||
|
style ["1","2"]
|
||||||
|
options "channel_videos",:i18n =>"videos.channel_videos",:options_item => {"query"=>"ChannelVideo.all", "value"=>:id, "label"=>:channel_name}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
side_bar do
|
||||||
|
head_label_i18n 'video.channel',:icon_class=>"icon-facetime-video"
|
||||||
|
available_for [:admin,:guest,:manager,:sub_manager]
|
||||||
|
active_for_controllers ({:private=>['channel_videos', 'videos']})
|
||||||
|
|
||||||
|
head_link_path "panel_video_back_end_channel_videos_path"
|
||||||
|
|
||||||
|
context_link 'video.channel',
|
||||||
|
:link_path=>"panel_video_back_end_channel_videos_path" ,
|
||||||
|
:priority=>1,
|
||||||
|
:available_for => [:manager]
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
module Video
|
||||||
|
VERSION = "0.0.1"
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||||
|
|
||||||
|
ENGINE_PATH = File.expand_path('../..', __FILE__)
|
||||||
|
load File.expand_path('../../test/dummy/script/rails', __FILE__)
|
|
@ -0,0 +1,23 @@
|
||||||
|
$:.push File.expand_path("../lib", __FILE__)
|
||||||
|
|
||||||
|
# Maintain your gem's version:
|
||||||
|
require "video/version"
|
||||||
|
|
||||||
|
# Describe your gem and declare its dependencies:
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = "video"
|
||||||
|
s.version = Video::VERSION
|
||||||
|
s.authors = ["RulingDigital"]
|
||||||
|
s.email = ["service@rulingcom.com"]
|
||||||
|
s.homepage = "http://www.rulingcom.com"
|
||||||
|
s.summary = ""
|
||||||
|
s.description = "Orbit Video module"
|
||||||
|
|
||||||
|
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||||
|
s.test_files = Dir["test/**/*"]
|
||||||
|
|
||||||
|
# s.add_dependency "rails", "~> 3.2.16"
|
||||||
|
# s.add_dependency "jquery-rails"
|
||||||
|
|
||||||
|
s.add_development_dependency "sqlite3"
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"title": "location",
|
||||||
|
"version": "0.1",
|
||||||
|
"organization": "Rulingcom",
|
||||||
|
"author": "RD dep",
|
||||||
|
"intro": "A simple blog……",
|
||||||
|
"update_info": "Some info",
|
||||||
|
"create_date": "11-11-2011",
|
||||||
|
"widgets": [],
|
||||||
|
"category": [],
|
||||||
|
"enable_frontend": false
|
||||||
|
}
|
Loading…
Reference in New Issue