From 88e7bdea6183c7d945c7dce5cd6707fa85f21dd4 Mon Sep 17 00:00:00 2001 From: spen Date: Fri, 22 Aug 2014 15:33:28 +0800 Subject: [PATCH] ntu_cph --- app/models/bulletin.rb | 2 ++ .../back_end/bulletins/_form.html.erb | 27 ++++++++++++++++++- .../front_end/bulletins/show.html.erb | 5 ++++ config/locales/en.yml | 2 +- config/locales/zh_tw.yml | 2 +- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb index e8bdd98..e93a868 100644 --- a/app/models/bulletin.rb +++ b/app/models/bulletin.rb @@ -21,6 +21,8 @@ class Bulletin field :title, localize: true field :subtitle, localize: true field :text, localize: true + + field :image_description, localize: true field :create_user_id field :update_user_id, :class_name => "User" diff --git a/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 9ef3a25..99a9613 100644 --- a/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -139,7 +139,32 @@ -
<%= t("announcement.image_note")%>
+ + + + + +
+ <%= f.label t("announcement.image_description"),{:class=>"control-label muted", :func=>"field_label"} %> +
+
+
+
+ <% @site_in_use_locales.each_with_index do |locale, i| %> +
" id="image_description_<%= locale %>"> + <%= f.fields_for :image_description_translations do |f| %> + <%= f.text_field locale, :value => (@bulletin.image_description_translations[locale] rescue nil), :placeholder=>"#{t("announcement.image_description")}" %> + <% end %> +
+ <% end %> +
+
+ <% @site_in_use_locales.each_with_index do |locale, i| %> + " href="#image_description_<%= locale %>" data-toggle="tab"><%= I18nVariable.from_locale(locale) %> + <% end %> +
+
+
diff --git a/app/views/panel/announcement/front_end/bulletins/show.html.erb b/app/views/panel/announcement/front_end/bulletins/show.html.erb index b6d6df2..0a43df6 100644 --- a/app/views/panel/announcement/front_end/bulletins/show.html.erb +++ b/app/views/panel/announcement/front_end/bulletins/show.html.erb @@ -8,6 +8,11 @@ <%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %> +
+ <%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %> + <%= link_to image_tag(@bulletin.image.url), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %> + <%= @bulletin.image_description unless @bulletin.image_description.blank? %> +
<%= @bulletin.text.html_safe rescue '' %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 5f0bb5e..b2e1a55 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -27,7 +27,7 @@ en: bulletins: Announcement front-end search_result: Search result image: Cover image - image_note: The image will not show in content + image_description: Cover Image Description link_name: Link Name new_bulletin_category: New Bulletin Category picture: Cover Picture diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 6e7509e..0314f6e 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -29,7 +29,7 @@ zh_tw: bulletins: 公告前台 search_result: 搜尋結果頁 image: 封面圖片 - image_note: 此處上傳的圖片不會在公告內文出現 + image_description: 封面圖片說明 link_name: 連結名稱 new_bulletin_category: 新增公告類別 picture: 刊頭圖片