fix news image description
This commit is contained in:
parent
3c435f0f91
commit
b303e8256a
|
@ -61,6 +61,12 @@ class NewsController < ApplicationController
|
|||
}
|
||||
end
|
||||
anns = news.collect do |a|
|
||||
if a.image_description.nil?
|
||||
image_description = "裝飾性圖片"
|
||||
else
|
||||
image_description = a.image_description
|
||||
end
|
||||
|
||||
statuses = a.statuses_with_classname.collect do |status|
|
||||
{
|
||||
"status" => status["name"],
|
||||
|
@ -75,6 +81,7 @@ class NewsController < ApplicationController
|
|||
"postdate" => a.postdate.strftime('%Y-%m-%d'),
|
||||
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
|
||||
"img_src" => a.image.thumb.url || "/assets/news_default_image.jpg",
|
||||
"img_description" => image_description,
|
||||
"more" => t(:more_plus)
|
||||
}
|
||||
end
|
||||
|
@ -114,6 +121,12 @@ class NewsController < ApplicationController
|
|||
categories.unshift({"name" => t("news.all"), "category-link" => "/#{I18n.locale.to_s + page.url}/"})
|
||||
|
||||
anns = news.collect do |a|
|
||||
if a.image_description.nil?
|
||||
image_description = "裝飾性圖片"
|
||||
else
|
||||
image_description = a.image_description
|
||||
end
|
||||
|
||||
statuses = a.statuses_with_classname.collect do |status|
|
||||
{
|
||||
"status" => status["name"],
|
||||
|
@ -128,6 +141,7 @@ class NewsController < ApplicationController
|
|||
"postdate" => a.postdate,
|
||||
"link_to_show" => OrbitHelper.widget_item_url(a.to_param),
|
||||
"img_src" => a.image.thumb.url || "/assets/news_default_image.jpg",
|
||||
"img_description" => image_description
|
||||
}
|
||||
end
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@ class NewsBulletin
|
|||
field :rejected, :type => Boolean, :default => false
|
||||
field :rejection_reason
|
||||
field :is_preview, :type => Boolean, :default => false
|
||||
field :image_description, localize: true
|
||||
|
||||
field :email_id
|
||||
field :email_sent, :type => Boolean, :default => false
|
||||
|
|
|
@ -165,9 +165,17 @@
|
|||
<label class="checkbox inline muted"> <%= t('news_bulletin.user_default_image')%></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<%= f.fields_for :image_description_translations do |f| %>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for="image_description_<%= locale.to_s %>"><%= t(:description) + " (#{t(locale.to_s)})" %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, value: (@news_bulletin.image_description_translations[locale.to_s] rescue nil) %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Language Tabs -->
|
||||
|
|
|
@ -89,3 +89,4 @@ zh_tw:
|
|||
mail_source: 來源
|
||||
mail_time: 時間
|
||||
image_upload_size_note: 建議檔案小於%{image_upload_size}
|
||||
image_description: 圖片描述
|
||||
|
|
Loading…
Reference in New Issue