diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 96f925e..def60f5 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -65,6 +65,8 @@ class AnnouncementsController < ApplicationController author = User.find(a.create_user_id).member_profile.name rescue "" desc = a.image_description desc = (desc.nil? || desc == "" ? "announcement image" : desc) + link_to_show = a.is_external_link ? a.external_link : OrbitHelper.url_to_show(a.to_param) + target = a.is_external_link ? "_blank" : "_self" anns << { "bulletin_links" => links, "bulletin_files" => files, @@ -78,7 +80,8 @@ class AnnouncementsController < ApplicationController "postdate" => a.postdate, "author" => author, "is_top" => (a.is_top? ? 1 : 0), - "link_to_show" => OrbitHelper.url_to_show(a.to_param), + "link_to_show" => link_to_show, + "target" => target, "img_src" => a.image.thumb.url || "/assets/announcement-default.jpg", "img_description" => desc, "more" => t(:more_plus), @@ -144,6 +147,7 @@ class AnnouncementsController < ApplicationController "source-site-title" => fa["source-site-title"], "source-site-link" => fa["source-site"], "link_to_show" => OrbitHelper.url_to_show(fa["params"]), + "target" => "_self", "img_src" => fa["image"]["thumb"] || "/assets/announcement-default.jpg", "img_description" => fa["image_description_translations"][locale], "more" => t(:more_plus), @@ -201,7 +205,9 @@ class AnnouncementsController < ApplicationController author = User.find(a.create_user_id).member_profile.name rescue "" desc = a.image_description desc = (desc.nil? || desc == "" ? "announcement image" : desc) - anns << { + link_to_show = a.is_external_link ? a.external_link : OrbitHelper.url_to_show(a.to_param) + target = a.is_external_link ? "_blank" : "_self" + anns << { "bulletin_links" => links, "bulletin_files" => files, "title" => a.title, @@ -213,7 +219,8 @@ class AnnouncementsController < ApplicationController "category" => a.category.title, "postdate" => a.postdate, "author" => author, - "link_to_show" => OrbitHelper.widget_item_url(a.to_param), + "link_to_show" => link_to_show, + "target" => target, "img_src" => a.image.thumb.url || "/assets/announcement-default.jpg", "img_description" => desc } diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb index 4f21b4c..6a295f3 100644 --- a/app/models/bulletin.rb +++ b/app/models/bulletin.rb @@ -24,6 +24,8 @@ class Bulletin field :rejected, :type => Boolean, :default => false field :reapproval, :type => Boolean, :default => false field :rejection_reason + field :is_external_link, :type => Boolean, :default => false + field :external_link field :email_id field :email_sent, :type => Boolean, :default => false diff --git a/app/views/admin/announcements/_form.html.erb b/app/views/admin/announcements/_form.html.erb index c8a001b..dec8ea1 100644 --- a/app/views/admin/announcements/_form.html.erb +++ b/app/views/admin/announcements/_form.html.erb @@ -52,6 +52,21 @@ +