diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 96cdfac..576e284 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -336,18 +336,23 @@ class AnnouncementsController < ApplicationController 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"}]) + 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, "bulletin_files" => files, "bulletin_links" => links, "data" => { "title" => announcement.title, - "subtitle_ann" => announcement.subtitle, + "subtitle_ann" => subtitle_ann, "update_user" => update_user, "updated_at" => announcement.postdate.strftime('%Y-%m-%d %H:%M'), "body" =>announcement.text, "image" => announcement.image.url, - "img_src" => announcement.image.thumb.url || "/assets/announcement-default.jpg", + "img_src" => img_src, "alt_title" => desc }, "impressionist" => (announcement.is_preview ? nil : announcement), diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb index 6a295f3..a7d6b83 100644 --- a/app/models/bulletin.rb +++ b/app/models/bulletin.rb @@ -26,6 +26,8 @@ class Bulletin field :rejection_reason field :is_external_link, :type => Boolean, :default => false field :external_link + field :display_subtitle, :type => Boolean, :default => false + field :display_img, :type => Boolean, :default => false field :email_id field :email_sent, :type => Boolean, :default => false @@ -94,4 +96,11 @@ class Bulletin end end + def display_subtitle? + self.display_subtitle rescue false + end + + def display_img? + self.display_img rescue false + end end diff --git a/app/views/admin/announcements/_form.html.erb b/app/views/admin/announcements/_form.html.erb index c789e22..96b6587 100644 --- a/app/views/admin/announcements/_form.html.erb +++ b/app/views/admin/announcements/_form.html.erb @@ -67,6 +67,21 @@ + +