From 69c0959b316dce3aed2e047fa7494ca5a5988823 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 2 Jun 2015 17:48:18 +0800 Subject: [PATCH] added image alternate text --- app/controllers/announcements_controller.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index d83bf6d..2bee4f3 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -17,6 +17,8 @@ class AnnouncementsController < ApplicationController files = a.bulletin_files.map{|file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title rescue '') } } rescue [] links = a.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue [] author = User.find(a.create_user_id).member_profile.name rescue "" + desc = a.image_description + desc = (desc.nil? || desc == "" ? "announcement image" : desc) { "bulletin_links" => links, "bulletin_files" => files, @@ -28,7 +30,7 @@ class AnnouncementsController < ApplicationController "author" => author, "link_to_show" => OrbitHelper.url_to_show(a.to_param), "img_src" => a.image.thumb.url || "/assets/announcement-default.jpg", - "img_description" => a.image_description, + "img_description" => desc, "more" => t(:more_plus), "view_count" => a.view_count } @@ -73,6 +75,8 @@ class AnnouncementsController < ApplicationController files = a.bulletin_files.map{|file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title rescue '') } } rescue [] links = a.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue [] author = User.find(a.create_user_id).member_profile.name rescue "" + desc = a.image_description + desc = (desc.nil? || desc == "" ? "announcement image" : desc) { "bulletin_links" => links, "bulletin_files" => files, @@ -84,7 +88,7 @@ class AnnouncementsController < ApplicationController "author" => author, "link_to_show" => OrbitHelper.widget_item_url(a.to_param), "img_src" => a.image.thumb.url || "/assets/announcement-default.jpg", - "img_description" => a.image_description + "img_description" => desc } end mp = (anns[0]["img_src"] rescue "") @@ -129,6 +133,8 @@ class AnnouncementsController < ApplicationController links = announcement.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue [] update_user = announcement.update_user.member_profile.name rescue "" + desc = announcement.image_description + desc = (desc.nil? || desc == "" ? "announcement image" : desc) { "tags" => tags, "bulletin_files" => files, @@ -138,7 +144,8 @@ class AnnouncementsController < ApplicationController "update_user" => update_user, "updated_at" => announcement.postdate.strftime('%Y-%m-%d %H:%M'), "body" =>announcement.text, - "image" => announcement.image.url + "image" => announcement.image.url, + "alt_title" => desc }, "impressionist" => (announcement.is_preview ? nil : announcement), "url_to_edit"=>url_to_edit