Browse Source

Added pagination

master
CharlotteGilhooly 12 years ago
parent
commit
62e430a54d
5 changed files with 15 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. +2
    -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

@@ -211,3 +211,12 @@ h2 {
font-size: 0.9rem;

}

.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.sort(:published.desc).paginate(:page => params[:page], :per_page => 20)

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


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

@@ -25,7 +25,7 @@
ago

%table#feed
- @feed.posts.each do |p|
- @posts.each do |p|
%tr
%td= link_to p.title, p.url
%td= link_to "Map", "https://maps.google.co.uk/maps?q=%s,%s&hl=en&z=18" % [ p.loc['lat'], p.loc['lng'] ], :target => "_blank"
@@ -33,3 +33,4 @@
- unless p.published.nil?
= p.published.strftime("%d %b %Y %H:%M")

= will_paginate @posts

Loading…
Cancel
Save