move unparamaterized dirs

rails2
Espen Antonsen 2009-08-10 22:17:58 +02:00
parent a976754781
commit fab8ba652a
2 changed files with 18 additions and 17 deletions

View File

@ -17,11 +17,20 @@
<% unless @album.photo_tags.empty? %>
<p>Tagged with:
<% for tag in @album.photo_tags.map{|tag|tag.title}.sort %>
<%= link_to tag, album_tag_photos_path(@album, tag )%>
<%= link_to tag, album_tag_photos_path(@album, tag) %>
<% end %>
</p>
<% end %>
<% unless @album.collections.empty? %>
<p>Part of:
<% for collection in @album.collections.find(:all, :order => 'title') %>
<%= link_to collection.title, collection_path(collection) %>
<% end %>
</p>
<% end %>
<% if has_role?("admin") %>
<p><%= @album.address %></p>
<% end %>
@ -29,6 +38,8 @@
<p><%= @album.note %></p>
<% end %>
<% content_for :action_links do %>
<% if has_role?("admin") %>
<%= link_to "PDF", album_path(@album, :format => 'pdf') %> |&nbsp;

View File

@ -22,14 +22,19 @@ module ScanFiles
relpathparam += d.parameterize + "/"
}
relpathparam = relpathparam.slice(0..relpathparam.length-2)
album = Album.find_by_path( relpath )
if relpath != relpathparam
puts APP_CONFIG[:photos_path] + relpath + " will now be moved to " + APP_CONFIG[:photos_path] + relpathparam
FileUtils.mv APP_CONFIG[:photos_path] + relpath, APP_CONFIG[:photos_path] + relpathparam
puts "reload!"
unless album.nil?
album.path = relpathparam
album.save!
end
self.FullScan
return
end
album = Album.find_by_path( relpath )
if prevalbum != relpath
puts relpath
prevalbum = relpath
@ -86,19 +91,4 @@ module ScanFiles
#image.write(mainsite_file)
end
def self.FullScanOld
self.ScanDirectory(APP_CONFIG[:photo_directory])
end
def self.ScanDirectory(dir)
puts "now scanning: " + dir
Dir.entries( dir ).select { |f| (f != "." && f != "..") }.each { |f|
if ( File.directory?( dir + f))
puts "found directory scan more.. " + dir + f + "/"
self.ScanDirectory( dir + f )
elsif ( supported_files.include?( File.extname(dir + f) ) )
puts "insert file in database: " + f
end
}
end
end