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 -%> -
- <% @albums.each do |album| -%> -
+ <% @albums.each_with_index do |album, index| -%> +

<%= album.name -%> (<%= album.photos.size -%> photos)

<% if album.album_thumbnail -%><% end -%>
<% end -%> -
+ +
+ + <%= partial 'shared/pagination_links' %> <% end -%> \ No newline at end of file diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb index 56db457..b4d5ee1 100644 --- a/app/views/albums/show.html.erb +++ b/app/views/albums/show.html.erb @@ -1,4 +1,5 @@ <% throw_content :for_sidebar do -%> + <% if allowed_to?(:create_albums) -%>Create Album Create An Album
<% end -%> <% if allowed_to?(:edit_album) -%> Edit Album
<% end %> <% if allowed_to?(:delete_albums) -%> Destroy Album
<% end %> <% if allowed_to?(:upload_images) -%> Upload Image
<% end %> diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index 1e3327e..cff9c0a 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -26,30 +26,6 @@ <%= partial 'pages/page', :with => [ page ] %> <% end -%> - <% if @page_count > 0 -%> - - <% end -%> + <%= partial 'shared/pagination_links' %> <% end -%> diff --git a/app/views/shared/_pagination_links.html.erb b/app/views/shared/_pagination_links.html.erb new file mode 100644 index 0000000..b762d74 --- /dev/null +++ b/app/views/shared/_pagination_links.html.erb @@ -0,0 +1,25 @@ +<% if @page_count > 0 -%> + +<% end -%> \ No newline at end of file