added alternate text

This commit is contained in:
Harry Bomrah 2015-06-02 17:48:53 +08:00
parent 6e6b1c9689
commit b204e28c86
1 changed files with 10 additions and 3 deletions

View File

@ -10,6 +10,8 @@ class AnnouncementsController < ApplicationController
"status-class" => "status-#{status['classname']}" "status-class" => "status-#{status['classname']}"
} }
end end
desc = a.image_description
desc = (desc.nil? || desc == "" ? "announcement image" : desc)
{ {
"title" => a.title, "title" => a.title,
"subtitle" => a.subtitle, "subtitle" => a.subtitle,
@ -18,7 +20,7 @@ class AnnouncementsController < ApplicationController
"postdate" => a.postdate, "postdate" => a.postdate,
"link_to_show" => OrbitHelper.url_to_show(a.to_param), "link_to_show" => OrbitHelper.url_to_show(a.to_param),
"img_src" => a.image.thumb.url || "http://placehold.it/100x100", "img_src" => a.image.thumb.url || "http://placehold.it/100x100",
"img_description" => a.image_description, "img_description" => desc,
"more" => t(:more_plus) "more" => t(:more_plus)
} }
end end
@ -47,6 +49,8 @@ class AnnouncementsController < ApplicationController
"status-class" => "status-#{status['classname']}" "status-class" => "status-#{status['classname']}"
} }
end end
desc = a.image_description
desc = (desc.nil? || desc == "" ? "announcement image" : desc)
{ {
"title" => a.title, "title" => a.title,
"subtitle" => a.subtitle, "subtitle" => a.subtitle,
@ -55,7 +59,7 @@ class AnnouncementsController < ApplicationController
"postdate" => a.postdate, "postdate" => a.postdate,
"link_to_show" => OrbitHelper.widget_item_url(a.to_param), "link_to_show" => OrbitHelper.widget_item_url(a.to_param),
"img_src" => a.image.thumb.url || "http://placehold.it/100x100", "img_src" => a.image.thumb.url || "http://placehold.it/100x100",
"img_description" => a.image_description "img_description" => desc
} }
end end
{ {
@ -92,6 +96,8 @@ class AnnouncementsController < ApplicationController
links = announcement.bulletin_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue [] 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 "" update_user = announcement.update_user.member_profile.name rescue ""
desc = announcement.image_description
desc = (desc.nil? || desc == "" ? "announcement image" : desc)
{ {
"tags" => tags, "tags" => tags,
"bulletin_files" => files, "bulletin_files" => files,
@ -101,7 +107,8 @@ class AnnouncementsController < ApplicationController
"update_user" => update_user, "update_user" => update_user,
"updated_at" => announcement.updated_at.strftime('%Y-%m-%d %H:%M'), "updated_at" => announcement.updated_at.strftime('%Y-%m-%d %H:%M'),
"body" =>announcement.text, "body" =>announcement.text,
"image" => announcement.image.url "image" => announcement.image.url,
"alt_image" => desc
}, },
"impressionist" => (announcement.is_preview ? nil : announcement), "impressionist" => (announcement.is_preview ? nil : announcement),
"url_to_edit"=>url_to_edit "url_to_edit"=>url_to_edit