Explorar el Código

Added pagination

master
Adrian Short hace 12 años
padre
commit
81eb66e022
Se han modificado 5 ficheros con 16 adiciones y 1 borrados
  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 Ver fichero

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

+ 2
- 0
Gemfile.lock Ver fichero

@@ -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 Ver fichero

@@ -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 Ver fichero

@@ -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 Ver fichero

@@ -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

Cargando…
Cancelar
Guardar