Fix bugs in Json when missing files

This commit is contained in:
chris 2012-11-13 15:21:59 +08:00
parent e8bd06307d
commit 9095713769
3 changed files with 6 additions and 7 deletions

View File

@ -132,17 +132,16 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
all_image << {
image_title: image.title,
image_description: image.description,
image_file: { url: "http://#{request.host_with_port+image.file.url}",
thumb: "http://#{request.host_with_port+image.file.thumb.to_s}"},
image_file: { url: "http://#{request.host_with_port}#{image.file.url}",
thumb: "http://#{request.host_with_port}#{image.file.thumb.to_s}"},
image_tag_names: tags}
end
album.tag_ids.each do |tag|
tag_names << GalleryTag.find(tag)[I18n.locale]
end
output << {
album_cover_file: "http://#{request.host_with_port+album.cover_path}",
album_cover_file: "http://#{request.host_with_port}#{album.cover_path}",
album_name: album.name,
album_tag_names: tag_names,
images: all_image

View File

@ -59,8 +59,8 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
@data = Array.new
locations.each do |location|
picurl = "http://#{request.host_with_port + location.file.url}",
thumburl = "http://#{request.host_with_port + location.file.thumb.url}"
picurl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.url}"
thumburl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.thumb.url}"
@data << { name: location.name,
pic_url: picurl,
thumb_url: thumburl,

View File

@ -13,7 +13,7 @@
<tbody id="tbody_locations" class="sort-holder">
<% @locations.each do |location| %>
<tr class="with_action">
<td><%= image_tag(location.file, alt: location.file, size: "50x50" )%></td>
<td><%= image_tag(location.file, alt: location.file, size: "50x50" ) if !location.file.blank? %></td>
<td><%= location.name%></td>
<td><%= location.longitude%></td>
<td><%= location.latitude%></td>