fix error

This commit is contained in:
chiu 2020-04-10 10:14:05 +08:00
parent 77c1cdaa2f
commit 8e7fe3ffe7
1 changed files with 6 additions and 2 deletions

View File

@ -15,7 +15,7 @@ class SiteFeedAnnc
def get_annc(annc_uid)
Array(self[:all_contents_for_feed]).select{|v| v['id']==annc_uid}[0] rescue {}
end
def all_contents_for_feed(site_source=nil,locale=I18n.locale.to_s)
def all_contents_for_feed(site_source=nil,locale=I18n.locale.to_s,is_widget=false)
cat = self.category_title
Array(self[:all_contents_for_feed]).collect do |v|
tmp = v
@ -57,7 +57,11 @@ class SiteFeedAnnc
tmp["subtitle"] = tmp["subtitle_translations"][locale]
tmp["source-site-link"] = tmp["source-site"]
tmp["source-site"] = "<a href='#{tmp["source-site"]}' target='_blank' class='feed-source'>#{tmp["source-site-title"]}</a>"
if !is_widget
tmp["link_to_show"] = OrbitHelper.url_to_show(tmp["params"]) rescue ''
else
tmp["link_to_show"] = OrbitHelper.widget_item_url(tmp["params"]) rescue ''
end
tmp["target"] = "_self"
tmp["img_src"] = tmp["image"]["thumb"] || "/assets/announcement-default.jpg"
tmp["img_description"] = tmp["image_description_translations"][locale]