Merge branch 'master' into 'master'

add i18n, add image description

* add i18n for displaying subtitle / cover image
* add img_description for front-end

See merge request !7
This commit is contained in:
EricTYL 2020-01-13 17:27:42 +08:00
commit 3883e1a661
4 changed files with 9 additions and 3 deletions

View File

@ -340,6 +340,7 @@ class AnnouncementsController < ApplicationController
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?
img_description = announcement.image_description if announcement.image_description.present?
{
"tags" => tags,
@ -353,6 +354,7 @@ class AnnouncementsController < ApplicationController
"body" =>announcement.text,
"image" => announcement.image.url,
"img_src" => img_src,
"img_description" => img_description,
"alt_title" => desc
},
"impressionist" => (announcement.is_preview ? nil : announcement),

View File

@ -69,7 +69,7 @@
<!-- display subtitle -->
<div class="control-group">
<%= f.label :display_subtitle, 'display subtitle', :class => "control-label muted" %>
<%= f.label :display_subtitle, t("announcement.display_subtitle"), :class => "control-label muted" %>
<div class="controls">
<%= f.check_box :display_subtitle %>
</div>
@ -77,7 +77,7 @@
<!-- display img src -->
<div class="control-group">
<%= f.label :display_img, 'display img src', :class => "control-label muted" %>
<%= f.label :display_img, t("announcement.display_img"), :class => "control-label muted" %>
<div class="controls">
<%= f.check_box :display_img %>
</div>

View File

@ -93,4 +93,6 @@ en:
resend_mail: Re-send Email
is_external_link: Enable External Link
external_link: External Link
external_link_hint: "Make sure URL starts with http://"
external_link_hint: "Make sure URL starts with http://"
display_subtitle: Display Subtitle
display_img: Display Cover Image

View File

@ -98,3 +98,5 @@ zh_tw:
is_external_link: 連結外部網址
external_link: 外部連結
external_link_hint: "確定連結開頭為http://"
display_subtitle: 顯示副標題
display_img: 顯示圖片