added hashtags

This commit is contained in:
rulingcom 2025-04-21 23:02:22 +08:00
parent cf21d457bf
commit d4adfc6b0e
1 changed files with 11 additions and 1 deletions

View File

@ -29,6 +29,7 @@ class VideoProsController < ApplicationController
end
def index
params = OrbitHelper.params
request = OrbitHelper.request
module_app = ModuleApp.where(:key=>'video_pro').first
page = OrbitHelper.page rescue Page.where(:url=>params[:url]).first
page_categories = OrbitHelper.page_categories
@ -141,6 +142,11 @@ class VideoProsController < ApplicationController
video_images = video_images.where(:use_override_post_agency=>true, :override_post_agency=>selected_post_agency.split('-').last)
end
end
if params[:hashtag].present?
video_images = video_images.where(video_tag_ids: params[:hashtag])
end
custom_data_field = (page.custom_data_field || {} rescue {})
videos = get_videos(video_images, OrbitHelper.url_to_show(''), custom_data_field)
hd_icon_url = "/assets/video_pro/icon_hd.png"
@ -149,13 +155,16 @@ class VideoProsController < ApplicationController
search_text1 = I18n.t("video_pro.search_text1")
search_text2 = I18n.t("video_pro.search_text2")
categories = categories.map do |category|
{"option"=>"<option value=\"#{category[:value]}\" #{category[:is_selected]}>#{category[:name]}</option>"}
end
tags = tags.map do |tag|
{"option"=>"<option value=\"#{tag[:value]}\" #{tag[:is_selected]}>#{tag[:name]}</option>"}
end
hashtags = VideoTag.all.map do |tag|
{"hashtag" => tag.title, "hash_url" => request.base_url + request.path + "?hashtag=#{tag.id.to_s}", "selected" => (params[:hashtag] == tag.id.to_s ? "selected" : "")}
end
{
"extras" => {
"search_placeholder" => search_placeholder,
@ -171,6 +180,7 @@ class VideoProsController < ApplicationController
},
"categories" => categories,
"tags" => tags,
"hashtags" => hashtags,
"post_agencies" => post_agencies,
"page_tabs" => page_tabs,
"videos" => videos,