From fce7ca7a135ae86f075991e5a0fe98c2130b4893 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 14 Oct 2014 14:28:51 +0800 Subject: [PATCH] added description for images in announcement --- app/controllers/announcements_controller.rb | 2 ++ app/models/bulletin.rb | 1 + app/views/admin/announcements/_form.html.erb | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 61f6fd3..ebd2ece 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -18,6 +18,7 @@ class AnnouncementsController < ApplicationController "postdate" => a.postdate, "link_to_show" => OrbitHelper.url_to_show(a.to_param), "img_src" => a.image.thumb.url || "http://placehold.it/100x100", + "img_description" => a.image_description, "more" => t(:more_plus) } end @@ -54,6 +55,7 @@ class AnnouncementsController < ApplicationController "postdate" => a.postdate, "link_to_show" => OrbitHelper.widget_item_url(a.to_param), "img_src" => a.image.thumb.url || "http://placehold.it/100x100", + "img_description" => a.image_description } end { diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb index 7f48cbb..601146a 100644 --- a/app/models/bulletin.rb +++ b/app/models/bulletin.rb @@ -26,6 +26,7 @@ class Bulletin field :email_sentdate , :type => DateTime field :email_member_ids field :other_mailaddress + field :image_description, localize: true mount_uploader :image, ImageUploader diff --git a/app/views/admin/announcements/_form.html.erb b/app/views/admin/announcements/_form.html.erb index a6106d8..0f64704 100644 --- a/app/views/admin/announcements/_form.html.erb +++ b/app/views/admin/announcements/_form.html.erb @@ -115,9 +115,20 @@ + <% @site_in_use_locales.each do |locale| %> + <%= f.fields_for :image_description_translations do |f| %> +
+ +
+ <%= f.text_field locale, value: (@bulletin.image_description_translations[locale.to_s] rescue nil) %> +
+
+ <% end %> + <% end %> +