dont show if no photos

rails2
Espen Antonsen 2009-06-11 18:45:25 +02:00
parent 53bcc62a45
commit c93ac2ad2c
4 changed files with 5 additions and 9 deletions

View File

@ -38,7 +38,6 @@ class PhotosController < ApplicationController
previous_rs = Photo.previous( @photo.id, @photo.album )
@previous = previous_rs.first if !previous_rs.empty?
next_rs = Photo.next( @photo.id, @photo.album )
puts next_rs.inspect
@next = next_rs.first if !next_rs.empty?
respond_to do |format|
format.html

View File

@ -77,13 +77,13 @@ class Album < ActiveRecord::Base
private
def create_folders
Dir.mkdir( APP_CONFIG[:photos_path] + self.path ) if !Dir.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[:photos_path] + self.path ) if !File.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
def destroy_folders
#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[:photos_path] + self.path ) if Dir.exists?( APP_CONFIG[:photos_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 File.exists?( APP_CONFIG[:photos_path] + self.path )
end
end

View File

@ -115,9 +115,6 @@ class Photo < ActiveRecord::Base
end
def exif_read
puts "exif read"
puts self.path
puts self.path_original
photo = MiniExiftool.new(self.path_original)
self.longitude = photo.GPSLongitude if self.longitude.nil?
self.latitude = photo.GPSLatitude if self.latitude.nil?

View File

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