| @@ -43,3 +43,4 @@ gem 'mm-multi-parameter-attributes' | |||||
| gem 'feedzirra' | gem 'feedzirra' | ||||
| gem 'htmlentities' | gem 'htmlentities' | ||||
| gem 'sorcery' | gem 'sorcery' | ||||
| gem 'will_paginate', '~> 3.0' | |||||
| @@ -146,6 +146,7 @@ GEM | |||||
| uglifier (1.2.5) | uglifier (1.2.5) | ||||
| execjs (>= 0.3.0) | execjs (>= 0.3.0) | ||||
| multi_json (~> 1.3) | multi_json (~> 1.3) | ||||
| will_paginate (3.0.3) | |||||
| PLATFORMS | PLATFORMS | ||||
| ruby | ruby | ||||
| @@ -163,3 +164,4 @@ DEPENDENCIES | |||||
| sass-rails (~> 3.2.3) | sass-rails (~> 3.2.3) | ||||
| sorcery | sorcery | ||||
| uglifier (>= 1.0.3) | uglifier (>= 1.0.3) | ||||
| will_paginate (~> 3.0) | |||||
| @@ -211,3 +211,12 @@ h2 { | |||||
| font-size: 0.9rem; | font-size: 0.9rem; | ||||
| } | } | ||||
| .pagination { | |||||
| .current { | |||||
| background-color: #00458F; | |||||
| color: white; | |||||
| font-style: normal; | |||||
| padding: 3px; | |||||
| } | |||||
| } | |||||
| @@ -17,6 +17,7 @@ class FeedsController < ApplicationController | |||||
| # GET /feeds/1.json | # GET /feeds/1.json | ||||
| def show | def show | ||||
| @feed = Feed.find(params[:id]) | @feed = Feed.find(params[:id]) | ||||
| @posts = @feed.posts.sort(:published.desc).paginate(:page => params[:page], :per_page => 20) | |||||
| respond_to do |format| | respond_to do |format| | ||||
| format.html # show.html.erb | format.html # show.html.erb | ||||
| @@ -25,7 +25,7 @@ | |||||
| ago | ago | ||||
| %table#feed | %table#feed | ||||
| - @feed.posts.each do |p| | |||||
| - @posts.each do |p| | |||||
| %tr | %tr | ||||
| %td= link_to p.title, p.url | %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" | %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? | - unless p.published.nil? | ||||
| = p.published.strftime("%d %b %Y %H:%M") | = p.published.strftime("%d %b %Y %H:%M") | ||||
| = will_paginate @posts | |||||