add hashtag to show

This commit is contained in:
rulingcom 2025-04-22 19:11:09 +08:00
parent dc5e24dcf2
commit e348e3e18f
2 changed files with 11 additions and 2 deletions

View File

@ -12,7 +12,8 @@ class VideoProsController < ApplicationController
video_image.view_count += 1 video_image.view_count += 1
video_image.inc_count video_image.inc_count
{ {
"video_image" => video_image "video_image" => video_image,
"url" => "/#{I18n.locale.to_s}" + OrbitHelper.page.url
} }
end end
def show_api def show_api
@ -168,7 +169,7 @@ class VideoProsController < ApplicationController
hashtag_id = hashtag.id.to_s rescue nil hashtag_id = hashtag.id.to_s rescue nil
hashtags = VideoTag.all.map do |tag| hashtags = VideoTag.all.map do |tag|
{"hashtag" => tag.title, "hash_url" => request.base_url + request.path + "?hashtag=#{tag.title}", "selected" => (hashtag_id == tag.id.to_s ? "selected" : "")} {"hashtag" => tag.title, "hash_url" => request.path + "?hashtag=#{tag.title}", "selected" => (hashtag_id == tag.id.to_s ? "selected" : "")}
end end
{ {
"extras" => { "extras" => {

View File

@ -28,6 +28,11 @@
%> %>
<div class="video_detail"> <div class="video_detail">
<h3><%= video_title %></h3> <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 %>
</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">
<iframe id="muteYouTubeVideoPlayer" frameborder="0" allowfullscreen="1"src="<%= video_url%>"></iframe> <iframe id="muteYouTubeVideoPlayer" frameborder="0" allowfullscreen="1"src="<%= video_url%>"></iframe>
@ -93,5 +98,8 @@
.view_info img{ .view_info img{
margin-right: 5px; margin-right: 5px;
} }
.hashtags li{
display: inline;
}
</style> </style>
</div> </div>