From 011f1c0f1e76ac8236a92ec64969da3a8eda7db6 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 28 May 2015 17:48:35 +0800 Subject: [PATCH] image alternate text for all of stuff --- app/controllers/galleries_controller.rb | 9 +++++++++ app/views/galleries/theater.html.erb | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index 636bab6..10b8d58 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -2,9 +2,11 @@ class GalleriesController < ApplicationController def index albums = Album.filter_by_categories.asc(:order) galleries = albums.collect do |a| + alt_text = (a.description.nil? || a.description == "" ? "gallery image" : a.description) { "album-name" => a.name, "album-description" => a.description, + "alt_title" => alt_text, "link_to_show" => OrbitHelper.url_to_show(a.to_param), "thumb-src" => a.cover_path || "/assets/gallery/default.jpg" } @@ -21,8 +23,10 @@ class GalleriesController < ApplicationController params = OrbitHelper.params album = Album.find_by_param(params[:uid]) images = album.album_images.asc(:order).collect do |a| + alt_text = (a.description.nil? || a.description == "" ? "gallery image" : a.description) { "image-description" => a.description, + "alt_title" => alt_text, "link_to_show" => "/" + I18n.locale.to_s + params[:url] + "/-" + a.id.to_s + "?method=theater", "thumb-src" => a.file.thumb.url } @@ -57,8 +61,11 @@ class GalleriesController < ApplicationController end end images = images.collect do |a| + alt_text = (a.description.nil? || a.description == "" ? "gallery image" : a.description) + { "link_to_show" => OrbitHelper.widget_more_url + "/-" + a.id.to_s + "?method=theater", + "alt_title" => alt_text, "thumb-src" => a.file.thumb.url } end @@ -74,9 +81,11 @@ class GalleriesController < ApplicationController images = album.album_images.asc(:order) output = Array.new images.each do |values| + alt_text = (values.description.nil? || values.description == "" ? "gallery image" : values.description) output << { _id: values.id.to_s, description: values.description, title: values.title, + alt_title: alt_text, file: values.file.as_json[:file], gallery_album_id: values.album_id, tags: values.tags} diff --git a/app/views/galleries/theater.html.erb b/app/views/galleries/theater.html.erb index a075902..c60b86f 100644 --- a/app/views/galleries/theater.html.erb +++ b/app/views/galleries/theater.html.erb @@ -15,7 +15,7 @@
-
+
Prev Next @@ -24,7 +24,7 @@