added member feature

This commit is contained in:
rulingcom 2025-05-05 21:57:59 +08:00
parent e348e3e18f
commit 1c325aa2bc
6 changed files with 26 additions and 0 deletions

View File

@ -11,8 +11,18 @@ class VideoProsController < ApplicationController
return if snapshot_url.nil?
video_image.view_count += 1
video_image.inc_count
members = MemberProfile.find(video_image.other_member_profiles)
profiles = []
members.each do |member|
profiles << {
"picture" => member.get_avatar,
"name" => member.name,
"autobiography" => member.autobiography
}
end
{
"video_image" => video_image,
"profiles" => profiles,
"url" => "/#{I18n.locale.to_s}" + OrbitHelper.page.url
}
end

View File

@ -35,6 +35,7 @@ class VideoImage
field :view_count, type: Integer, default: 0
field :scale, type: Float
field :details, type: String, localize: true
field :other_member_profiles, type: Array, default: []
has_and_belongs_to_many :video_tags, inverse_of: :video_images
# LINK_OPEN_TYPES = ["local", "new_window"]

View File

@ -325,6 +325,12 @@
<% end %>
</div>
<div class="control-group big-group">
<label class="control-label muted"><%= t("video_pro.members") %></label>
<div class="controls">
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'video_image[other_member_profiles][]', email_members: MemberProfile.find(@video_image.other_member_profiles), select_name: "author_members", index: 'author_members', extra_class: 'custom-class'} %>
</div>
</div>
</div>

View File

@ -26,6 +26,13 @@
video_tags = video_image.tags
video_tags = (video_tags.count > 0 ? video_tags.collect{|tag| {"video_tag" => tag.name}} : [{"video_tag" => video_category}])
%>
<div class="profiles">
<% data["profiles"].each do |profile| %>
<img src="<%= profile["picture"] %>">
<span><%= profile["name"] %></span>
<div><%= profile["autobiography"].html_safe %></div>
<% end %>
</div>
<div class="video_detail">
<h3><%= video_title %></h3>
<ul class="hashtags">

View File

@ -72,4 +72,5 @@ en:
details: Details
hashtags: Hashtags
select_or_add: Select or add tags
members: Members
video: Video

View File

@ -69,4 +69,5 @@ zh_tw:
details: 詳細內容
hashtags: Hashtags
select_or_add: Select or add tags
members: Members
video: 影片