Skip to content

Commit

Permalink
[#3798406] Pagination for unread knots
Browse files Browse the repository at this point in the history
  • Loading branch information
Riccardo Cambiassi committed Jan 3, 2011
1 parent c210479 commit b095a7e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -11,6 +11,7 @@ gem 'aasm'
gem 'haml'
gem "friendly_id"
gem "stringex"
gem 'will_paginate', "~> 3.0.pre2"

gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'

Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Expand Up @@ -155,6 +155,7 @@ GEM
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
will_paginate (3.0.pre2)
wirble (0.1.3)
yard (0.6.4)

Expand Down Expand Up @@ -186,4 +187,5 @@ DEPENDENCIES
stringex
test-unit
webrat
will_paginate (~> 3.0.pre2)
wirble
7 changes: 5 additions & 2 deletions app/controllers/knots_controller.rb
Expand Up @@ -5,9 +5,12 @@ class KnotsController < ApplicationController
# GET /knots
# GET /knots.xml
def index
@knots = current_user.knots
@knots = current_user.knots
respond_to do |format|
format.html # index.html.erb
format.html do
@unread = @knots.unread.paginate :page => params[:page], :per_page => 10
@read = @knots.read[0..9]
end
format.xml { render :xml => @knots }
format.rss { render :layout => false }
end
Expand Down
8 changes: 6 additions & 2 deletions app/views/knots/index.html.haml
Expand Up @@ -5,9 +5,13 @@
= link_to t(".bookmarklet_name"), bookmarklet, { :title => t(".bookmarklet_hint"), :onclick => "alert('" + t(".bookmarklet_hint") + "'); return false;" }
=t (".bookmarklet")
%h3= t("knots.index.unread")
= will_paginate @unread
%ol.knots.unread
= render :partial => 'knot', :collection => @knots.unread, :locals => { :actions => true }
= render :partial => 'knot', :collection => @unread, :locals => { :actions => true }
= will_paginate @unread
= page_entries_info @unread
%h3= t("knots.index.read")
%ol.knots.read
= render :partial => 'knot', :collection => @knots.read, :locals => { :actions => true }
= render :partial => 'knot', :collection => @read, :locals => { :actions => true }


0 comments on commit b095a7e

Please sign in to comment.