From b05bc6818c0f68fa84df481b6bf966568b498757 Mon Sep 17 00:00:00 2001 From: Coleman Date: Fri, 27 Jun 2008 21:03:57 -0500 Subject: [PATCH] only 12 photos per page instead and actually put in the pagination links --- app/controllers/albums.rb | 5 ++-- app/views/albums/show.html.erb | 27 +++++++-------------- app/views/shared/_pagination_links.html.erb | 8 +++--- 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/app/controllers/albums.rb b/app/controllers/albums.rb index 6ad484a..bef4ba5 100644 --- a/app/controllers/albums.rb +++ b/app/controllers/albums.rb @@ -19,10 +19,11 @@ class Albums < Application pcount = @album.photos.size @page = params[:page].to_i - per_page = 20 + per_page = 12 @page_count = (pcount.to_f / per_page.to_f).ceil.to_i @page = 0 if @page >= @page_count - @url_key = :photos + @url_key = :album + @paginate_id = @album.name.gsub(/ /, '_') @photos = @album.photos.find(:all, :limit => per_page, :offset => (@page * per_page), :order => 'filename ASC') diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb index 3aafcba..1e779bc 100644 --- a/app/views/albums/show.html.erb +++ b/app/views/albums/show.html.erb @@ -9,8 +9,7 @@ .photo_collection_item { word-wrap: break-word; - width: 150px; - min-height: 150px; + max-width: 150px; max-height: 150px; margin-top: 15px; margin-bottom: 15px; @@ -20,20 +19,9 @@ position: relative; } -.col_1 { - margin-left: 5px; -} - -.col_2 { - margin-left: 5px; -} - -.col_3 { - margin-left: 5px; -} - -.col_0 { - margin-left: 5px; +.col_1, .col_2, .col_0 { + margin-left: 15px; + margin-right: 15px; } <% end -%> @@ -41,8 +29,9 @@

<%= @album.name -%>

-<% @album.photos.each_with_index do |photo, idx| -%> -
+<% @photos.each_with_index do |photo, idx| -%> +
+ <% if (idx + 1) % 3 == 0 or @photos.last == photo -%>
<% end -%> <% end -%> <% unless @album.tags.empty? -%> @@ -52,3 +41,5 @@ <% end -%>
+ +<%= partial 'shared/pagination_links' %> diff --git a/app/views/shared/_pagination_links.html.erb b/app/views/shared/_pagination_links.html.erb index b762d74..38c6a43 100644 --- a/app/views/shared/_pagination_links.html.erb +++ b/app/views/shared/_pagination_links.html.erb @@ -2,22 +2,22 @@