Fix bugs in Json when missing files
This commit is contained in:
parent
e8bd06307d
commit
9095713769
|
@ -132,17 +132,16 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||||
all_image << {
|
all_image << {
|
||||||
image_title: image.title,
|
image_title: image.title,
|
||||||
image_description: image.description,
|
image_description: image.description,
|
||||||
image_file: { url: "http://#{request.host_with_port+image.file.url}",
|
image_file: { url: "http://#{request.host_with_port}#{image.file.url}",
|
||||||
thumb: "http://#{request.host_with_port+image.file.thumb.to_s}"},
|
thumb: "http://#{request.host_with_port}#{image.file.thumb.to_s}"},
|
||||||
image_tag_names: tags}
|
image_tag_names: tags}
|
||||||
end
|
end
|
||||||
|
|
||||||
album.tag_ids.each do |tag|
|
album.tag_ids.each do |tag|
|
||||||
tag_names << GalleryTag.find(tag)[I18n.locale]
|
tag_names << GalleryTag.find(tag)[I18n.locale]
|
||||||
end
|
end
|
||||||
|
|
||||||
output << {
|
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_name: album.name,
|
||||||
album_tag_names: tag_names,
|
album_tag_names: tag_names,
|
||||||
images: all_image
|
images: all_image
|
||||||
|
|
|
@ -59,8 +59,8 @@ class Panel::Gprs::BackEnd::LocationsController < OrbitBackendController
|
||||||
@data = Array.new
|
@data = Array.new
|
||||||
|
|
||||||
locations.each do |location|
|
locations.each do |location|
|
||||||
picurl = "http://#{request.host_with_port + location.file.url}",
|
picurl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.url}"
|
||||||
thumburl = "http://#{request.host_with_port + location.file.thumb.url}"
|
thumburl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.thumb.url}"
|
||||||
@data << { name: location.name,
|
@data << { name: location.name,
|
||||||
pic_url: picurl,
|
pic_url: picurl,
|
||||||
thumb_url: thumburl,
|
thumb_url: thumburl,
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<tbody id="tbody_locations" class="sort-holder">
|
<tbody id="tbody_locations" class="sort-holder">
|
||||||
<% @locations.each do |location| %>
|
<% @locations.each do |location| %>
|
||||||
<tr class="with_action">
|
<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.name%></td>
|
||||||
<td><%= location.longitude%></td>
|
<td><%= location.longitude%></td>
|
||||||
<td><%= location.latitude%></td>
|
<td><%= location.latitude%></td>
|
||||||
|
|
Reference in New Issue