diff --git a/app/controllers/albums.rb b/app/controllers/albums.rb index b364d44..fcd278e 100644 --- a/app/controllers/albums.rb +++ b/app/controllers/albums.rb @@ -1,6 +1,14 @@ class Albums < Application def index - @albums = Album.find(:all) + acount = Album.count + @page = params[:page].to_i + per_page = 12 + @page_count = (acount.to_f / per_page.to_f).ceil.to_i + @page = 0 if @page >= @page_count + @url_key = :albums + + @albums = Album.find(:all, :limit => per_page, :offset => (@page * per_page), :order => 'name ASC') + @tags = Album.popular_tags(30) display @albums end diff --git a/app/controllers/news.rb b/app/controllers/news.rb index 443ae0b..f95ff50 100644 --- a/app/controllers/news.rb +++ b/app/controllers/news.rb @@ -5,6 +5,7 @@ class News < Application per_page = 5 @page_count = (ncount.to_f / per_page.to_f).ceil.to_i @page = 0 if @page >= @page_count + @url_key = :news @page_title = 'Blogging!' @news = Page.find :all, :limit => per_page, :offset => (@page * per_page), :conditions => [ 'published = ?', true ], :order => 'created_at DESC' @oldest_date = Page.find(:first, :order => 'created_at ASC').created_at rescue nil diff --git a/app/controllers/pages.rb b/app/controllers/pages.rb index b79a976..3bd76b8 100644 --- a/app/controllers/pages.rb +++ b/app/controllers/pages.rb @@ -9,7 +9,6 @@ class Pages < Application def show @page = Page.find_by_name(params[:id].gsub(/_/, ' ')) if @page.nil? - flash[:error] = "That page does not exist. You can now create it." redirect url(:new_page, :new_name => params[:id]) else @comments = @page.comments @@ -23,7 +22,7 @@ class Pages < Application only_provides :html @page = Page.new if params[:new_name] - flash.now[:notice] = 'That page does not exist, but you can create it.' + flash.now[:error] = 'That page does not exist, but you can create it.' @page.name = params[:new_name].gsub(/_/, ' ') end render diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb index 27cc038..510abb0 100644 --- a/app/views/albums/index.html.erb +++ b/app/views/albums/index.html.erb @@ -9,19 +9,29 @@ <% throw_content :for_stylesheet do -%> -.photo_collection { - word-wrap: break-word; -} - .photo_collection_item { - float: right; + word-wrap: break-word; width: 170px; min-height: 140px; max-height: 200px; - margin: 5px; + margin-top: 15px; padding: 5px; text-align: center; border: 1px solid #BBB; + float: left; + position: relative; +} + +.col_1 { + margin-left: 10px; +} + +.col_2 { + margin-left: 10px; +} + +.col_0 { + margin-left: 10px; } <% end -%> @@ -29,12 +39,14 @@ <% if @albums.empty? -%>
There were no albums found!
<% else -%> -<%= album.name -%> (<%= album.photos.size -%> photos)
<% if album.album_thumbnail -%><% end -%>