diff --git a/app/controllers/albums.rb b/app/controllers/albums.rb index fcd278e..6ad484a 100644 --- a/app/controllers/albums.rb +++ b/app/controllers/albums.rb @@ -16,6 +16,16 @@ class Albums < Application def show @album = Album.find_by_name(params[:id].gsub(/_/, ' ')) raise NotFound unless @album + + pcount = @album.photos.size + @page = params[:page].to_i + per_page = 20 + @page_count = (pcount.to_f / per_page.to_f).ceil.to_i + @page = 0 if @page >= @page_count + @url_key = :photos + + @photos = @album.photos.find(:all, :limit => per_page, :offset => (@page * per_page), :order => 'filename ASC') + display @album end diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb index b4d5ee1..3aafcba 100644 --- a/app/views/albums/show.html.erb +++ b/app/views/albums/show.html.erb @@ -7,8 +7,33 @@ <% throw_content :for_stylesheet do -%> -.photo { - margin: 10px; +.photo_collection_item { + word-wrap: break-word; + width: 150px; + min-height: 150px; + max-height: 150px; + margin-top: 15px; + margin-bottom: 15px; + padding: 3px; + border: 1px solid #BBB; + float: left; + position: relative; +} + +.col_1 { + margin-left: 5px; +} + +.col_2 { + margin-left: 5px; +} + +.col_3 { + margin-left: 5px; +} + +.col_0 { + margin-left: 5px; } <% end -%> @@ -17,9 +42,7 @@

<%= @album.name -%>

<% @album.photos.each_with_index do |photo, idx| -%> - <% if (idx + 1) % 3 == 1 -%>

<% end -%> - - <% if (idx + 1) % 3 == 0 or @album.photos.size == (idx + 1) -%>

<% end -%> +
<% end -%> <% unless @album.tags.empty? -%>