bootstrap-ruby / will_paginate-bootstrap

Integrates the Twitter Bootstrap pagination component with will_paginate
MIT License
388 stars 160 forks source link

Very many pages #3

Closed anu-vaid closed 12 years ago

anu-vaid commented 12 years ago

Is there a way to introduce a disabled gap in the middle if there are many pages?

nickpad commented 12 years ago

A "gap" element should be displayed if there are enough items in the pagination collection. Here's a really simple example which demonstrates this using Sinatra:

require "sinatra"
require "will_paginate-bootstrap"
require "will_paginate/collection"

$template = <<EOHTML
<html>
<head>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet">
</head>
<body>
<%= will_paginate @collection, :renderer => BootstrapPagination::Sinatra %>
</body>
</html>
EOHTML

get "/" do
  @collection = WillPaginate::Collection.new 1, 10, 100000
  erb $template
end

If you put that in a file and run it (with sinatra and will_paginate-bootstrap gems installed) - you'll see a gap.

There are also various will_paginate options you can tweak to control when the gap gets displayed: https://github.com/mislav/will_paginate/blob/master/lib/will_paginate/view_helpers.rb

nickpad commented 12 years ago

If I haven't understood correctly, feel free to re-open!

anu-vaid commented 12 years ago

Thank you so much for the quick response. Still trying to figure out how to do it in Rails app. I have

<%= will_paginate @products, :renderer => BootstrapPagination::Rails %>

and in my model I have

self.per_page = 10

in the controller

@products = @company. products.page(params[:page])

I know I am missing something. I tried

<%= will_paginate @feeds, :renderer => BootstrapPagination::Rails, :inner_window => 4, :outer_window => 1 %>

but that did not help.


Anupama Vaid www.parentsquare.com 805.637.8381

On Sep 17, 2012, at 9:50 AM, Nick Dainty wrote:

A "gap" element should be displayed if there are enough items in the pagination collection. Here's a really simple example which demonstrates this using Sinatra:

require "sinatra" require "will_paginate-bootstrap" require "will_paginate/collection"

$template = <<EOHTML

<%= will_paginate @collection, :renderer => BootstrapPagination::Sinatra %>

EOHTML

get "/" do @collection = WillPaginate::Collection.new 1, 10, 100000 erb $template end If you put that in a file and run it (with sinatra and will_paginate-bootstrap gems installed) - you'll see a gap.

There are also various will_paginate options you can tweak to control when the gap gets displayed: https://github.com/mislav/will_paginate/blob/master/lib/will_paginate/view_helpers.rb

— Reply to this email directly or view it on GitHub.

anu-vaid commented 12 years ago

Nevermind - It comes up when there are too many records.

Sorry about the post.

Thanks, Anu


Anupama Vaid www.parentsquare.com 805.637.8381

On Sep 17, 2012, at 10:12 AM, Anupama Vaid wrote:

Thank you so much for the quick response. Still trying to figure out how to do it in Rails app. I have

<%= will_paginate @products, :renderer => BootstrapPagination::Rails %>

and in my model I have

self.per_page = 10

in the controller

@products = @company. products.page(params[:page])

I know I am missing something. I tried

<%= will_paginate @feeds, :renderer => BootstrapPagination::Rails, :inner_window => 4, :outer_window => 1 %>

but that did not help.


Anupama Vaid www.parentsquare.com 805.637.8381

On Sep 17, 2012, at 9:50 AM, Nick Dainty wrote:

A "gap" element should be displayed if there are enough items in the pagination collection. Here's a really simple example which demonstrates this using Sinatra:

require "sinatra" require "will_paginate-bootstrap" require "will_paginate/collection"

$template = <<EOHTML

<%= will_paginate @collection, :renderer => BootstrapPagination::Sinatra %>

EOHTML

get "/" do @collection = WillPaginate::Collection.new 1, 10, 100000 erb $template end If you put that in a file and run it (with sinatra and will_paginate-bootstrap gems installed) - you'll see a gap.

There are also various will_paginate options you can tweak to control when the gap gets displayed: https://github.com/mislav/will_paginate/blob/master/lib/will_paginate/view_helpers.rb

— Reply to this email directly or view it on GitHub.

poombavai commented 8 years ago

Hi.. inner_window and outer_window doesnot showing me any changes in my page.. I have tried like, my views,
<%= will_paginate @issue, page_links: true, inner_window: 2, outer_window: 1 %> my controller, @issue = Issue.all.paginate(page: params[:page], per_page: 5).order("issue_slip_no DESC") .. How should I correct it?

zhukovRoman commented 8 years ago

@poombavai I have this problem too. Did you solve it?

poombavai commented 8 years ago

@zhukovRoman No. Not yet. Tried pagination with Kaminari gem.

poombavai commented 8 years ago

@zhukovRoman No. Not yet. Tried pagination with Kaminari gem.