image alternate text for all of stuff

This commit is contained in:
Harry Bomrah 2015-05-28 17:48:35 +08:00
parent c98ceae1d6
commit 011f1c0f1e
2 changed files with 11 additions and 2 deletions

View File

@ -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}

View File

@ -15,7 +15,7 @@
<div id="imgholder">
<div class="rslide" style="position:relative; width:100%;">
<div class="rslideinside"><div id="loading" style="display:none;"></div>
<div class="comp" id='main_pic' data-content='<%= @image.album_id %>'><a href="" id="nextpic" class="navN" title="下一張" onclick="return false;" ><img src="<%= @image.file.theater.url %>" alt="" /></a></div>
<div class="comp" id='main_pic' data-content='<%= @image.album_id %>'><a href="" id="nextpic" class="navN" title="下一張" onclick="return false;" ><img src="<%= @image.file.theater.url %>" alt="<%= @image.description.nil? || @image.description == "" ? "gallery image" : @image.description %>" /></a></div>
<div class="rslidenav">
<a href="" class="navP" title="上一張" onclick="return false;">Prev</a>
<a href="" class="navN" title="下一張" onclick="return false;">Next</a>
@ -24,7 +24,7 @@
<div class="slidelist">
<ul id='galleryimagelist' style="display:none;">
<% @images.each_with_index do |image,i| %>
<li for="<%= i %>"><a href="<%= image.id %>" class="list_element" data-content="<%= image.file.theater.url %>" onclick="return false;"><img src="<%= image.file.thumb.url %>" alt="" /></a></li>
<li for="<%= i %>"><a href="<%= image.id %>" class="list_element" data-content="<%= image.file.theater.url %>" onclick="return false;"><img src="<%= image.file.thumb.url %>" alt="<%= image.description.nil? || image.description == "" ? "gallery image" : image.description %>" /></a></li>
<% end %>
</ul>
</div>