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