changed to global tag
This commit is contained in:
parent
570283fba7
commit
5bb521685f
|
|
@ -22,6 +22,7 @@ class VideoProsController < ApplicationController
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
"video_image" => video_image,
|
"video_image" => video_image,
|
||||||
|
"orbithashtags" => video_image.hashtags_for_frontend,
|
||||||
"profiles" => profiles,
|
"profiles" => profiles,
|
||||||
"url" => "/#{I18n.locale.to_s}" + OrbitHelper.page.url
|
"url" => "/#{I18n.locale.to_s}" + OrbitHelper.page.url
|
||||||
}
|
}
|
||||||
|
|
@ -154,12 +155,8 @@ class VideoProsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
hashtag = nil
|
if params[:orbithashtag].present?
|
||||||
if params[:hashtag].present?
|
video_images = video_images.filter_by_hashtag(OrbitHelper.page_hashtag_id)
|
||||||
hashtag = VideoTag.where(:title => params[:hashtag]).first rescue nil
|
|
||||||
if !hashtag.nil?
|
|
||||||
video_images = video_images.where(video_tag_ids: hashtag.id)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
custom_data_field = (page.custom_data_field || {} rescue {})
|
custom_data_field = (page.custom_data_field || {} rescue {})
|
||||||
|
|
@ -177,10 +174,7 @@ class VideoProsController < ApplicationController
|
||||||
{"option"=>"<option value=\"#{tag[:value]}\" #{tag[:is_selected]}>#{tag[:name]}</option>"}
|
{"option"=>"<option value=\"#{tag[:value]}\" #{tag[:is_selected]}>#{tag[:name]}</option>"}
|
||||||
end
|
end
|
||||||
|
|
||||||
hashtag_id = hashtag.id.to_s rescue nil
|
hashtags = OrbitHelper.this_module_app.hashtags.get_all_module_hashtags_for_frontend
|
||||||
hashtags = VideoTag.all.map do |tag|
|
|
||||||
{"hashtag" => tag.title, "hash_url" => request.path + "?hashtag=#{tag.title}", "selected" => (hashtag_id == tag.id.to_s ? "selected" : "")}
|
|
||||||
end
|
|
||||||
{
|
{
|
||||||
"extras" => {
|
"extras" => {
|
||||||
"search_placeholder" => search_placeholder,
|
"search_placeholder" => search_placeholder,
|
||||||
|
|
@ -192,11 +186,11 @@ class VideoProsController < ApplicationController
|
||||||
"hd_icon_url" => hd_icon_url,
|
"hd_icon_url" => hd_icon_url,
|
||||||
"view_icon_url" => view_icon_url,
|
"view_icon_url" => view_icon_url,
|
||||||
"more" => "More",
|
"more" => "More",
|
||||||
"page-title" => page_title
|
"page-title" => page_title,
|
||||||
|
"orbithashtags" => hashtags
|
||||||
},
|
},
|
||||||
"categories" => categories,
|
"categories" => categories,
|
||||||
"tags" => tags,
|
"tags" => tags,
|
||||||
"hashtags" => hashtags,
|
|
||||||
"post_agencies" => post_agencies,
|
"post_agencies" => post_agencies,
|
||||||
"page_tabs" => page_tabs,
|
"page_tabs" => page_tabs,
|
||||||
"videos" => videos,
|
"videos" => videos,
|
||||||
|
|
@ -293,7 +287,8 @@ class VideoProsController < ApplicationController
|
||||||
"video_title_escape" => video_title_escape,
|
"video_title_escape" => video_title_escape,
|
||||||
"video_desc" => video_desc,
|
"video_desc" => video_desc,
|
||||||
"video_keyword" => video_keyword,
|
"video_keyword" => video_keyword,
|
||||||
"view_count" => video_image.view_count
|
"view_count" => video_image.view_count,
|
||||||
|
"hashtags" => video_image.hashtags_for_frontend
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ class VideoImage
|
||||||
include OrbitModel::Status
|
include OrbitModel::Status
|
||||||
include OrbitModel::Impression
|
include OrbitModel::Impression
|
||||||
include OrbitTag::Taggable
|
include OrbitTag::Taggable
|
||||||
|
include OrbitHashtag::Hashtaggable
|
||||||
include OrbitCategory::Categorizable
|
include OrbitCategory::Categorizable
|
||||||
include Slug
|
include Slug
|
||||||
mount_uploader :file, VideoDataImageUploader
|
mount_uploader :file, VideoDataImageUploader
|
||||||
|
|
@ -218,13 +219,13 @@ class VideoImage
|
||||||
return if youtube.blank?
|
return if youtube.blank?
|
||||||
return if self.youtube_changed? == false
|
return if self.youtube_changed? == false
|
||||||
uri = URI.parse(youtube) rescue nil
|
uri = URI.parse(youtube) rescue nil
|
||||||
if uri&.host == "www.youtube.com"
|
if uri.host == "www.youtube.com"
|
||||||
self.is_youtube = true
|
self.is_youtube = true
|
||||||
if uri.path.start_with?('/embed/')
|
if uri.path.start_with?('/embed/')
|
||||||
self.youtube_id = uri.path.split('/embed/').last.split(/[\/#?]/).first
|
self.youtube_id = uri.path.split('/embed/').last.split(/[\/#?]/).first
|
||||||
else
|
else
|
||||||
params = CGI.parse(uri.query.to_s)
|
params = CGI.parse(uri.query.to_s)
|
||||||
self.youtube_id = params['v']&.first
|
self.youtube_id = params['v'].first
|
||||||
end
|
end
|
||||||
self.is_youtube = false if youtube_id.blank?
|
self.is_youtube = false if youtube_id.blank?
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||||
<%= stylesheet_link_tag "lib/fileupload" %>
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
||||||
<%= stylesheet_link_tag "video_data/jplayer.blue.monday.min" %>
|
<%= stylesheet_link_tag "video_data/jplayer.blue.monday.min" %>
|
||||||
<%= stylesheet_link_tag "select2/select2" %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% content_for :page_specific_javascript do %>
|
<% content_for :page_specific_javascript do %>
|
||||||
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||||||
|
|
@ -11,7 +10,6 @@
|
||||||
<%= javascript_include_tag "lib/module-area" %>
|
<%= javascript_include_tag "lib/module-area" %>
|
||||||
<%= javascript_include_tag "validator" %>
|
<%= javascript_include_tag "validator" %>
|
||||||
<%= javascript_include_tag "video_data/jquery.jplayer.min" %>
|
<%= javascript_include_tag "video_data/jquery.jplayer.min" %>
|
||||||
<%= javascript_include_tag "select2/select2.min" %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.fileupload .video-thumbnail{
|
.fileupload .video-thumbnail{
|
||||||
|
|
@ -259,7 +257,7 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t("video_pro.hashtags") %></label>
|
<label class="control-label muted"><%= t("video_pro.hashtags") %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input id="video_image_video_tags_" type="hidden" name="video_tags" />
|
<%= select_hashtags(f, @module_app) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,7 @@
|
||||||
<div class="video_detail">
|
<div class="video_detail">
|
||||||
<h3><%= video_title %></h3>
|
<h3><%= video_title %></h3>
|
||||||
<ul class="hashtags">
|
<ul class="hashtags">
|
||||||
<% video_image.video_tags.each do |tag| %>
|
<%= data["orbithashtags"] %>
|
||||||
<li><a href="<%= data["url"] + "?hashtag=#{tag.title}" %>">#<%= tag.title %></a></li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
</ul>
|
||||||
<% if video_image.is_youtube %>
|
<% if video_image.is_youtube %>
|
||||||
<div class="video_yt_box video_box_wrap">
|
<div class="video_yt_box video_box_wrap">
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,31 @@
|
||||||
# task :video_pro do
|
# task :video_pro do
|
||||||
# # Task goes here
|
# # Task goes here
|
||||||
# end
|
# end
|
||||||
|
namespace :video_pro_tasks do
|
||||||
|
desc "Migrate old tags to new tags"
|
||||||
|
task :migrate_tags => :environment do
|
||||||
|
module_app = ModuleApp.find_by_key("video_pro")
|
||||||
|
dataset = {}
|
||||||
|
VideoTag.all.each do |vt|
|
||||||
|
next if vt.title.blank? # Skip if tag name is blank
|
||||||
|
puts "Processing tag: #{vt.title}"
|
||||||
|
module_app.reload
|
||||||
|
hashtag = module_app.hashtags.where(name: vt.title).first_or_initialize
|
||||||
|
hashtag.module_app_ids << module_app.id.to_s unless hashtag.module_app_ids.include?(module_app.id.to_s)
|
||||||
|
puts "New record #{hashtag.new_record?}"
|
||||||
|
hashtag.save if hashtag.new_record?
|
||||||
|
puts "Hashtag ID: #{hashtag.id} - #{hashtag.name}"
|
||||||
|
vt.video_images.each do |vi|
|
||||||
|
unless vi.hashtags.include?(hashtag)
|
||||||
|
dataset[vi] ||= []
|
||||||
|
dataset[vi] << hashtag.id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
dataset.each do |vi, tag_ids|
|
||||||
|
puts "Updating TableEntry #{vi.id} with tags: #{tag_ids.join(', ')}"
|
||||||
|
vi.hashtags= tag_ids
|
||||||
|
vi.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ module VideoPro
|
||||||
widget_settings [{"multiselect"=>false,"display_field"=>"title","enable_custom_widget_data"=>true, "data_count"=>30}]
|
widget_settings [{"multiselect"=>false,"display_field"=>"title","enable_custom_widget_data"=>true, "data_count"=>30}]
|
||||||
# models_to_cache [:video_data,:video_image]
|
# models_to_cache [:video_data,:video_image]
|
||||||
taggable "VideoImage"
|
taggable "VideoImage"
|
||||||
|
hashtaggable "VideoImage"
|
||||||
categorizable
|
categorizable
|
||||||
authorizable
|
authorizable
|
||||||
frontend_enabled
|
frontend_enabled
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue