move unparamaterized dirs

This commit is contained in:
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? %> <% unless @album.photo_tags.empty? %>
<p>Tagged with: <p>Tagged with:
<% for tag in @album.photo_tags.map{|tag|tag.title}.sort %> <% 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 %> <% end %>
</p> </p>
<% end %> <% 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") %> <% if has_role?("admin") %>
<p><%= @album.address %></p> <p><%= @album.address %></p>
<% end %> <% end %>
@ -29,6 +38,8 @@
<p><%= @album.note %></p> <p><%= @album.note %></p>
<% end %> <% end %>
<% content_for :action_links do %> <% content_for :action_links do %>
<% if has_role?("admin") %> <% if has_role?("admin") %>
<%= link_to "PDF", album_path(@album, :format => 'pdf') %> |&nbsp; <%= link_to "PDF", album_path(@album, :format => 'pdf') %> |&nbsp;

View file

@ -22,14 +22,19 @@ module ScanFiles
relpathparam += d.parameterize + "/" relpathparam += d.parameterize + "/"
} }
relpathparam = relpathparam.slice(0..relpathparam.length-2) relpathparam = relpathparam.slice(0..relpathparam.length-2)
album = Album.find_by_path( relpath )
if relpath != relpathparam if relpath != relpathparam
puts APP_CONFIG[:photos_path] + relpath + " will now be moved to " + APP_CONFIG[:photos_path] + 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 FileUtils.mv APP_CONFIG[:photos_path] + relpath, APP_CONFIG[:photos_path] + relpathparam
puts "reload!" puts "reload!"
unless album.nil?
album.path = relpathparam
album.save!
end
self.FullScan self.FullScan
return return
end end
album = Album.find_by_path( relpath )
if prevalbum != relpath if prevalbum != relpath
puts relpath puts relpath
prevalbum = relpath prevalbum = relpath
@ -86,19 +91,4 @@ module ScanFiles
#image.write(mainsite_file) #image.write(mainsite_file)
end 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 end