Browse Source

Added pagination

master
Adrian Short 12 years ago
parent
commit
81eb66e022
5 changed files with 16 additions and 1 deletions
  1. +1
    -0
      Gemfile
  2. +2
    -0
      Gemfile.lock
  3. +9
    -0
      app/assets/stylesheets/scaffolds.css.scss
  4. +1
    -0
      app/controllers/feeds_controller.rb
  5. +3
    -1
      app/views/feeds/show.html.haml

+ 1
- 0
Gemfile View File

@@ -43,3 +43,4 @@ gem 'mm-multi-parameter-attributes'
gem 'feedzirra'
gem 'htmlentities'
gem 'sorcery'
gem 'will_paginate', '~> 3.0'

+ 2
- 0
Gemfile.lock View File

@@ -146,6 +146,7 @@ GEM
uglifier (1.2.5)
execjs (>= 0.3.0)
multi_json (~> 1.3)
will_paginate (3.0.3)

PLATFORMS
ruby
@@ -163,3 +164,4 @@ DEPENDENCIES
sass-rails (~> 3.2.3)
sorcery
uglifier (>= 1.0.3)
will_paginate (~> 3.0)

+ 9
- 0
app/assets/stylesheets/scaffolds.css.scss View File

@@ -147,3 +147,12 @@ h2 {
#userbar {
background-color: #eee;
}

.pagination {
.current {
background-color: #00458F;
color: white;
font-style: normal;
padding: 3px;
}
}

+ 1
- 0
app/controllers/feeds_controller.rb View File

@@ -17,6 +17,7 @@ class FeedsController < ApplicationController
# GET /feeds/1.json
def show
@feed = Feed.find(params[:id])
@posts = @feed.posts.paginate(:page => params[:page], :per_page => 20)

respond_to do |format|
format.html # show.html.erb


+ 3
- 1
app/views/feeds/show.html.haml View File

@@ -23,7 +23,7 @@
ago

%table
- @feed.posts.each do |p|
- @posts.each do |p|
%tr
%td= link_to p.title, p.url
%td= p.loc['lat']
@@ -32,6 +32,8 @@
- unless p.published.nil?
= p.published.strftime("%d %b %Y %H:%M")

= will_paginate @posts

= link_to 'Edit', edit_feed_path(@feed)
\|
= link_to 'Back', :root

Loading…
Cancel
Save