added external link option
This commit is contained in:
parent
d6cb086a4a
commit
c06e87fb05
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -52,6 +52,21 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<%= f.label :is_external_link, t("announcement.is_external_link"), :class => "control-label muted" %>
|
||||
<div class="controls">
|
||||
<%= f.check_box :is_external_link %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" style="display: none;" id="external_link_box">
|
||||
<%= f.label :external_link, t("announcement.external_link"), :class => "control-label muted" %>
|
||||
<div class="controls">
|
||||
<%= f.text_field :external_link %>
|
||||
<div class="hint"><%= t("announcement.external_link_hint") %></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Status Module -->
|
||||
|
@ -441,6 +456,14 @@
|
|||
},100)
|
||||
})
|
||||
|
||||
$("#bulletin_is_external_link").on("click",function(){
|
||||
if($(this).is(":checked")){
|
||||
$("#external_link_box").show();
|
||||
}else{
|
||||
$("#external_link_box").hide();
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
|
@ -75,4 +75,7 @@ en:
|
|||
mail_source: Source
|
||||
mail_time: Time
|
||||
image_upload_size_note: The following recommendations %{image_upload_size} upload size
|
||||
resend_mail: Re-send Email
|
||||
resend_mail: Re-send Email
|
||||
is_external_link: Enable External Link
|
||||
external_link: External Link
|
||||
external_link_hint: "Make sure URL starts with http://"
|
|
@ -79,3 +79,6 @@ zh_tw:
|
|||
mail_time: 時間
|
||||
image_upload_size_note: 建議檔案小於%{image_upload_size}
|
||||
resend_mail: 重新寄送提醒
|
||||
is_external_link: 開啟內部連結
|
||||
external_link: 外部連結
|
||||
external_link_hint: "確定連結開頭為http://"
|
||||
|
|
Loading…
Reference in New Issue