Compare commits
No commits in common. "master" and "dev" have entirely different histories.
|
|
@ -77,7 +77,7 @@ class Admin::VideoProsController < OrbitAdminController
|
|||
end
|
||||
|
||||
def create_get_video_tags(video)
|
||||
new_tags = params["video_tags"].present? ? params["video_tags"].split(",") : []
|
||||
new_tags = params["video_tags"].split(",")
|
||||
tags = []
|
||||
video.video_tags = []
|
||||
new_tags.each do |tag|
|
||||
|
|
|
|||
|
|
@ -243,30 +243,15 @@ class VideoProsController < ApplicationController
|
|||
def get_videos(video_images, show_url, custom_data_field={})
|
||||
@autoplay_video = custom_data_field[:autoplay_video] rescue "0"
|
||||
@hide_video_tools = custom_data_field[:hide_video_tools] == "1" rescue false
|
||||
|
||||
video_image_ids = video_images.map(&:id)
|
||||
hashtaggings_by_video = Hashtagging.where(:hashtaggable_id.in => video_image_ids, :hashtaggable_type => "VideoImage").group_by(&:hashtaggable_id)
|
||||
all_hashtag_ids = hashtaggings_by_video.values.flatten.map(&:hashtag_id).compact.uniq
|
||||
hashtags_by_id = Hashtag.where(:id.in => all_hashtag_ids).to_a.index_by(&:id)
|
||||
|
||||
taggings_by_video = Tagging.where(:taggable_id.in => video_image_ids, :taggable_type => "VideoImage").group_by(&:taggable_id)
|
||||
all_tag_ids = taggings_by_video.values.flatten.map(&:tag_id).compact.uniq
|
||||
tags_by_id = Tag.where(:id.in => all_tag_ids).to_a.index_by(&:id)
|
||||
|
||||
all_category_ids = video_images.map(&:category_id).compact.uniq
|
||||
categories_by_id = Category.where(:id.in => all_category_ids).to_a.index_by(&:id)
|
||||
|
||||
id_name_mapping = User.where(:id.in=>video_images.map(&:update_user_id).compact.uniq).pluck(:id, "member_name.#{I18n.locale}").map{|k,v| [k.to_s, (v ? v.values.last : nil)]}.to_h
|
||||
|
||||
videos = []
|
||||
video_images.each_with_index do |video_image,i|
|
||||
if video_image.language_enabled.include?(I18n.locale.to_s)
|
||||
snapshot_url = video_image.get_snapshot_url
|
||||
next if snapshot_url.nil?
|
||||
video_post_agency = video_image.post_agency(@video_pro_setting, id_name_mapping)
|
||||
video_post_agency = video_image.post_agency(@video_pro_setting)
|
||||
video_postdate = video_image.postdate.to_s
|
||||
video_category = video_image.category_title(categories_by_id[video_image.category_id])
|
||||
video_tags = video_image.tags((taggings_by_video[video_image.id] || []).map{|tg| tags_by_id[tg.tag_id]}.compact)
|
||||
video_category = video_image.category_title
|
||||
video_tags = video_image.tags
|
||||
video_tags = (video_tags.count > 0 ? video_tags.collect{|tag| {"video_tag" => tag.name}} : [{"video_tag" => video_category}])
|
||||
statuses = video_image.statuses_with_classname
|
||||
video_desc = video_image.desc
|
||||
|
|
|
|||
|
|
@ -89,11 +89,9 @@ class VideoImage
|
|||
def inc_count
|
||||
self.class.where(:id=>self.id).update_all({"$inc"=>{"view_count"=>1}})
|
||||
end
|
||||
|
||||
def category_title(preloaded_category=nil)
|
||||
self.category(preloaded_category).title rescue ""
|
||||
def category_title
|
||||
self.category.title rescue ""
|
||||
end
|
||||
|
||||
def post_agencies_translations
|
||||
if defined?(OrbitHelper::SharedHash) && OrbitHelper::SharedHash
|
||||
OrbitHelper::SharedHash['video_pro'][:post_agencies_translations] rescue VideoProSetting.first.post_agencies_translations
|
||||
|
|
@ -104,8 +102,7 @@ class VideoImage
|
|||
def get_override_post_agency
|
||||
self.post_agencies_translations[I18n.locale.to_s][self.override_post_agency] rescue ""
|
||||
end
|
||||
|
||||
def post_agency(video_pro_setting=nil, id_name_mapping=nil)
|
||||
def post_agency(video_pro_setting=nil)
|
||||
if self.use_override_post_agency
|
||||
self.get_override_post_agency
|
||||
else
|
||||
|
|
@ -115,17 +112,16 @@ class VideoImage
|
|||
if video_pro_setting && video_pro_setting.enable_name_mapping
|
||||
tmp = video_pro_setting.user_mapping[self.update_user_id] rescue nil
|
||||
if tmp.blank?
|
||||
user_name = id_name_mapping ? id_name_mapping[self.update_user_id] : (User.where(:id=>self.update_user_id).pluck(:member_name).first[I18n.locale.to_s] rescue nil)
|
||||
user_name = User.where(:id=>self.update_user_id).pluck(:member_name).first[I18n.locale.to_s] rescue nil
|
||||
else
|
||||
user_name = tmp
|
||||
end
|
||||
else
|
||||
user_name = id_name_mapping ? id_name_mapping[self.update_user_id] : (User.where(:id=>self.update_user_id).pluck(:member_name).first[I18n.locale.to_s] rescue nil)
|
||||
user_name = User.where(:id=>self.update_user_id).pluck(:member_name).first[I18n.locale.to_s] rescue nil
|
||||
end
|
||||
user_name
|
||||
end
|
||||
end
|
||||
|
||||
def generate_video_snapshot
|
||||
if self.video_file?
|
||||
self.default_video_snapshot = true
|
||||
|
|
@ -206,10 +202,6 @@ class VideoImage
|
|||
I18n.t("announcement.status.hidden")
|
||||
end
|
||||
|
||||
def get_other_member_profiles_names_for_frontend
|
||||
MemberProfile.find(self.other_member_profiles).map{|m,n| {"name" => m.name}} rescue []
|
||||
end
|
||||
|
||||
def get_snapshot_url
|
||||
# self.video_snapshot.url rescue ""
|
||||
self.is_youtube ? self.file.url : (self.video_snapshot.url)
|
||||
|
|
|
|||
|
|
@ -66,13 +66,6 @@
|
|||
<span><img src="<%= view_icon_url %>" alt="<%= view_count_trans %>">x <%= view_count %></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="other_member_profiles">
|
||||
<% video_image.get_other_member_profiles_names_for_frontend.each do |profile| %>
|
||||
<div class="other_profile">
|
||||
<span class="other_profile_name"><%= profile["name"] %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<style>
|
||||
.video_box_wrap{
|
||||
height: 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue