return subtitle_ann / img_src when they are displayable
This commit is contained in:
parent
2501d578bd
commit
0cba386e89
|
@ -336,18 +336,23 @@ class AnnouncementsController < ApplicationController
|
||||||
meta_desc = announcement.subtitle.nil? || announcement.subtitle == "" ? announcement.text[0..200] : announcement.subtitle
|
meta_desc = announcement.subtitle.nil? || announcement.subtitle == "" ? announcement.text[0..200] : announcement.subtitle
|
||||||
OrbitHelper.render_meta_tags([{"property" => "og:title", "content" => announcement.title},{"property" => "og:site_name", "content" => Site.first.title},{"property" => "og:url", "content" => request.original_url.split("?").first},{"property" => "og:description", "content" => meta_desc},{"property" => "og:image", "content" => "#{request.base_url}#{announcement.image.url}"},{"property" => "og:type", "content" => "Article"}])
|
OrbitHelper.render_meta_tags([{"property" => "og:title", "content" => announcement.title},{"property" => "og:site_name", "content" => Site.first.title},{"property" => "og:url", "content" => request.original_url.split("?").first},{"property" => "og:description", "content" => meta_desc},{"property" => "og:image", "content" => "#{request.base_url}#{announcement.image.url}"},{"property" => "og:type", "content" => "Article"}])
|
||||||
|
|
||||||
|
subtitle_ann = nil
|
||||||
|
img_src = nil
|
||||||
|
subtitle_ann = announcement.subtitle if announcement.display_subtitle?
|
||||||
|
img_src = (announcement.image.thumb.url || "/assets/announcement-default.jpg") if announcement.display_img?
|
||||||
|
|
||||||
{
|
{
|
||||||
"tags" => tags,
|
"tags" => tags,
|
||||||
"bulletin_files" => files,
|
"bulletin_files" => files,
|
||||||
"bulletin_links" => links,
|
"bulletin_links" => links,
|
||||||
"data" => {
|
"data" => {
|
||||||
"title" => announcement.title,
|
"title" => announcement.title,
|
||||||
"subtitle_ann" => announcement.subtitle,
|
"subtitle_ann" => subtitle_ann,
|
||||||
"update_user" => update_user,
|
"update_user" => update_user,
|
||||||
"updated_at" => announcement.postdate.strftime('%Y-%m-%d %H:%M'),
|
"updated_at" => announcement.postdate.strftime('%Y-%m-%d %H:%M'),
|
||||||
"body" =>announcement.text,
|
"body" =>announcement.text,
|
||||||
"image" => announcement.image.url,
|
"image" => announcement.image.url,
|
||||||
"img_src" => announcement.image.thumb.url || "/assets/announcement-default.jpg",
|
"img_src" => img_src,
|
||||||
"alt_title" => desc
|
"alt_title" => desc
|
||||||
},
|
},
|
||||||
"impressionist" => (announcement.is_preview ? nil : announcement),
|
"impressionist" => (announcement.is_preview ? nil : announcement),
|
||||||
|
|
Loading…
Reference in New Issue