dont show if no photos
This commit is contained in:
parent
53bcc62a45
commit
c93ac2ad2c
4 changed files with 5 additions and 9 deletions
|
@ -38,7 +38,6 @@ class PhotosController < ApplicationController
|
||||||
previous_rs = Photo.previous( @photo.id, @photo.album )
|
previous_rs = Photo.previous( @photo.id, @photo.album )
|
||||||
@previous = previous_rs.first if !previous_rs.empty?
|
@previous = previous_rs.first if !previous_rs.empty?
|
||||||
next_rs = Photo.next( @photo.id, @photo.album )
|
next_rs = Photo.next( @photo.id, @photo.album )
|
||||||
puts next_rs.inspect
|
|
||||||
@next = next_rs.first if !next_rs.empty?
|
@next = next_rs.first if !next_rs.empty?
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
|
|
@ -77,13 +77,13 @@ class Album < ActiveRecord::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_folders
|
def create_folders
|
||||||
Dir.mkdir( APP_CONFIG[:photos_path] + self.path ) if !Dir.exists?( APP_CONFIG[:photos_path] + self.path )
|
Dir.mkdir( APP_CONFIG[:photos_path] + self.path ) if !File.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||||
Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path ) if !Dir.exists?( APP_CONFIG[:photos_path] + self.path )
|
Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path ) if !File.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy_folders
|
def destroy_folders
|
||||||
#puts "DELETE DIRECTORY " + APP_CONFIG[:photos_path] + self.path
|
#puts "DELETE DIRECTORY " + APP_CONFIG[:photos_path] + self.path
|
||||||
Dir.delete( APP_CONFIG[:thumbs_path] + self.path ) if Dir.exists?( APP_CONFIG[:thumbs_path] + self.path )
|
Dir.delete( APP_CONFIG[:thumbs_path] + self.path ) if File.exists?( APP_CONFIG[:thumbs_path] + self.path )
|
||||||
Dir.delete( APP_CONFIG[:photos_path] + self.path ) if Dir.exists?( APP_CONFIG[:photos_path] + self.path )
|
Dir.delete( APP_CONFIG[:photos_path] + self.path ) if File.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -115,9 +115,6 @@ class Photo < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def exif_read
|
def exif_read
|
||||||
puts "exif read"
|
|
||||||
puts self.path
|
|
||||||
puts self.path_original
|
|
||||||
photo = MiniExiftool.new(self.path_original)
|
photo = MiniExiftool.new(self.path_original)
|
||||||
self.longitude = photo.GPSLongitude if self.longitude.nil?
|
self.longitude = photo.GPSLongitude if self.longitude.nil?
|
||||||
self.latitude = photo.GPSLatitude if self.latitude.nil?
|
self.latitude = photo.GPSLatitude if self.latitude.nil?
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<p><%= render :partial => "photos/thumb", :locals => {:photo => album.photos.find(:first) } %></p>
|
<p><%= render :partial => "photos/thumb", :locals => { :photo => album.photos.find(:first) } unless album.photos.empty? %></p>
|
Loading…
Add table
Reference in a new issue