hmm
This commit is contained in:
parent
2643e019e2
commit
1b94fcc84f
|
@ -23,17 +23,6 @@ class Photo < ActiveRecord::Base
|
||||||
named_scope :previous, lambda { |p,a| { :conditions => ["id < :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id DESC"} }
|
named_scope :previous, lambda { |p,a| { :conditions => ["id < :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id DESC"} }
|
||||||
named_scope :next, lambda { |p,a| { :conditions => ["id > :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id ASC"} }
|
named_scope :next, lambda { |p,a| { :conditions => ["id > :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id ASC"} }
|
||||||
|
|
||||||
def self.search(q)
|
|
||||||
if q
|
|
||||||
conditions = q.split("AND").each {|var|
|
|
||||||
|
|
||||||
}
|
|
||||||
find(:all)
|
|
||||||
else
|
|
||||||
find(:all)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_param
|
def to_param
|
||||||
"#{id}-#{title.parameterize}"
|
"#{id}-#{title.parameterize}"
|
||||||
end
|
end
|
||||||
|
@ -76,9 +65,9 @@ class Photo < ActiveRecord::Base
|
||||||
|
|
||||||
def exif_info
|
def exif_info
|
||||||
photo = MiniExiftool.new(self.path_original)
|
photo = MiniExiftool.new(self.path_original)
|
||||||
photo.tags.sort.each do |tag|
|
#photo.tags.sort.each do |tag|
|
||||||
puts tag.ljust(28) + photo[tag].to_s
|
# puts tag.ljust(28) + photo[tag].to_s
|
||||||
end
|
#end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Map file extensions to mime types.
|
# Map file extensions to mime types.
|
||||||
|
@ -92,6 +81,8 @@ class Photo < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_thumbnails
|
def create_thumbnails
|
||||||
|
# TODO: thumbnails size should be set in settings.yml
|
||||||
|
|
||||||
return if File.exists?(APP_CONFIG[:thumbs_path] + self.album.path + "/" + self.id.to_s + "_collection" + self.extension)
|
return if File.exists?(APP_CONFIG[:thumbs_path] + self.album.path + "/" + self.id.to_s + "_collection" + self.extension)
|
||||||
puts "thumb " + self.path_original
|
puts "thumb " + self.path_original
|
||||||
ImageScience.with_image(self.path_original) do |img|
|
ImageScience.with_image(self.path_original) do |img|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
<% content_for :action_links do %>
|
<% content_for :action_links do %>
|
||||||
<% if has_role?("admin") %>
|
<% if has_role?("admin") %>
|
||||||
|
|
||||||
<%= link_to("Delete album", { :action => "destroy", :id => @album },
|
<%= link_to("Delete album", { :action => "destroy", :id => @album },
|
||||||
:confirm => "Are you sure you want to delete this album?",
|
:confirm => "Are you sure you want to delete this album?",
|
||||||
:method => :delete) %>
|
:method => :delete) %>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Be sure to restart your server when you modify this file
|
# Be sure to restart your server when you modify this file
|
||||||
|
|
||||||
# Specifies gem version of Rails to use when vendor/rails is not present
|
# Specifies gem version of Rails to use when vendor/rails is not present
|
||||||
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
|
#RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
|
||||||
|
|
||||||
# Bootstrap the Rails environment, frameworks, and default configuration
|
# Bootstrap the Rails environment, frameworks, and default configuration
|
||||||
require File.join(File.dirname(__FILE__), 'boot')
|
require File.join(File.dirname(__FILE__), 'boot')
|
||||||
|
|
Loading…
Reference in a new issue