add show_feed category、hashtags
This commit is contained in:
parent
ff9331e58b
commit
7f4b054a8b
|
|
@ -850,6 +850,26 @@ class AnnouncementsController < ApplicationController
|
|||
locale = OrbitHelper.get_site_locale.to_s
|
||||
url_to_edit = "#"
|
||||
return nil if announcement.blank?
|
||||
|
||||
category_title = ""
|
||||
if announcement["category"].present? && announcement["category"]["title_translations"].present?
|
||||
category_title = announcement["category"]["title_translations"][locale] rescue ""
|
||||
end
|
||||
|
||||
orbithashtags_data = announcement["orbithashtags"] rescue []
|
||||
|
||||
orbithashtags_output = ""
|
||||
if orbithashtags_data.is_a?(Array) && orbithashtags_data.any?
|
||||
orbithashtags_output = orbithashtags_data.map do |hashtag_obj|
|
||||
name = hashtag_obj["name"].to_s rescue ""
|
||||
next if name.blank?
|
||||
|
||||
"<span class=\"s-annc__hashtag label label-default\">#{name}</span>"
|
||||
end.compact.join(" ")
|
||||
end
|
||||
|
||||
orbithashtags = orbithashtags_output.html_safe
|
||||
|
||||
tags = []
|
||||
|
||||
announcement["tags"].each{|tag|
|
||||
|
|
@ -932,6 +952,8 @@ class AnnouncementsController < ApplicationController
|
|||
"update_user" => update_user,
|
||||
"updated_at" => (datetime.in_time_zone(Time.zone.utc_offset / 3600).strftime('%Y-%m-%d %H:%M') rescue ""),
|
||||
"body" => announcement["text_translations"][locale],
|
||||
"category" => category_title,
|
||||
"orbithashtags" => orbithashtags,
|
||||
"image" => announcement["image"]["original"],
|
||||
"img_src" => img_src,
|
||||
"img_description" => img_description,
|
||||
|
|
|
|||
Loading…
Reference in New Issue