fix thumb

This commit is contained in:
邱博亞 2022-02-27 12:20:59 +08:00
parent dfb994cc2c
commit 6ecd58de1d
1 changed files with 16 additions and 0 deletions

View File

@ -190,6 +190,14 @@ class SiteFeedAnnc
self.collection.aggregate(pipeline).collect do |data|
tmp = data['data']
tmp['category'] = tmp['category'][locale]
if @image_version != 'thumb' && !@image_version.nil?
if @image_version == 'mobile'
tmp["img_src"] = tmp["image"]["mobile"]
else
tmp["img_src"] = tmp["image"]["original"]
end
tmp["img_src"] = tmp["img_src"] || "/assets/announcement-default.jpg"
end
if tmp["link_to_show"].nil?
if !is_widget
tmp["link_to_show"] = UseSourceUrl && tmp["show_url"] ? "#{tmp["source_url"]}/#{locale}#{tmp["show_url"]}" : OrbitHelper.url_to_show(tmp["params"]) rescue ''
@ -213,6 +221,14 @@ class SiteFeedAnnc
tmp = v
next if tmp["is_hidden"] || (!tmp["postdate"].nil? && tmp["postdate"]<Time.now) || tmp['title'].blank?
tmp['category'] = tmp['category'][locale]
if @image_version != 'thumb' && !@image_version.nil?
if @image_version == 'mobile'
tmp["img_src"] = tmp["image"]["mobile"]
else
tmp["img_src"] = tmp["image"]["original"]
end
tmp["img_src"] = tmp["img_src"] || "/assets/announcement-default.jpg"
end
if tmp["link_to_show"].nil?
if !is_widget
tmp["link_to_show"] = UseSourceUrl && tmp["show_url"] ? "#{tmp["source_url"]}/#{locale}#{tmp["show_url"]}" : OrbitHelper.url_to_show(tmp["params"]) rescue ''