From 5bb521685fdf4818348807c638e2164ad5b562ec Mon Sep 17 00:00:00 2001 From: rulingcom Date: Thu, 7 Aug 2025 22:55:32 +0800 Subject: [PATCH] changed to global tag --- app/controllers/video_pros_controller.rb | 21 +++++++---------- app/models/video_image.rb | 5 ++-- app/views/admin/video_pros/_form.html.erb | 4 +--- app/views/video_pros/show.html.erb | 4 +--- lib/tasks/video_pro_tasks.rake | 28 +++++++++++++++++++++++ lib/video_pro/engine.rb | 3 ++- 6 files changed, 43 insertions(+), 22 deletions(-) diff --git a/app/controllers/video_pros_controller.rb b/app/controllers/video_pros_controller.rb index c07953b..274c064 100644 --- a/app/controllers/video_pros_controller.rb +++ b/app/controllers/video_pros_controller.rb @@ -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"=>""} 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 diff --git a/app/models/video_image.rb b/app/models/video_image.rb index 50eea34..9857260 100644 --- a/app/models/video_image.rb +++ b/app/models/video_image.rb @@ -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 diff --git a/app/views/admin/video_pros/_form.html.erb b/app/views/admin/video_pros/_form.html.erb index 6dee49b..908bae3 100644 --- a/app/views/admin/video_pros/_form.html.erb +++ b/app/views/admin/video_pros/_form.html.erb @@ -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 %>