Giter Club home page Giter Club logo

bootstrap-will_paginate's Introduction

I haven't used this gem in years and I don't have the time to keep it updated. Happy to give it to someone actively using it.

Will Paginate link renderer styles for Twitter Bootstrap 3/4

Rails Engine that extends will_paginate stylings to match the pagination styling conventions in Twitter's Bootstrap toolkit.

The real hard work done on the renderer initializer was written by Isaac Bowen.

Demo picture

Demo of boostrap-will_paginate

Installation

Add to your Gemfile:

gem 'bootstrap-will_paginate'

Usage

Just like you would in the regular will_paginate. If you've got a need to use the default will_paginate stylings, pass an option like so:

<%= will_paginate(@things, :renderer => WillPaginate::ActionView::LinkRenderer) %>

To use Bootstrap 4 version:

<%= will_paginate(@things, :renderer => WillPaginate::ActionView::Bootstrap4LinkRenderer) %>

Size and Alignment of the Pagination Component

You can easily change the pagination components' appearance by passing the correct Bootstrap classes as options:

Sizing(Bootstrap 3 & 4): Add .pagination-lg or .pagination-sm for additional sizes.

<%= will_paginate(@things, :renderer => WillPaginate::ActionView::Bootstrap4LinkRenderer, class: 'pagination-lg') %>

Alignment (Bootstrap 4 only): Change the alignment of pagination components using Boostrap 4 Flexbox utilities

<%= will_paginate(@things, :renderer => WillPaginate::ActionView::Bootstrap4LinkRenderer, class: 'justify-content-center') %>

Copyright (c) 2017 Nicholas Fine, Isaac Bowen released under the MIT license

bootstrap-will_paginate's People

Contributors

asurin avatar christianclassen avatar deanpcmad avatar greggersh avatar ipepe avatar jann avatar yalcin avatar yrgoldteeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bootstrap-will_paginate's Issues

Add Bootstrap v4 support

Although, Bootstrap 4 is in alpha right now but I would like to see some support for the newest framework when it comes out in beta. It looks pretty sick. What do you guys think?

How to error

You how to configure the plugin has the error on :renderer => WillPaginate::ActionView::LinkRenderer

As Rails 3 and will_paginate 3.0.4 the correct syntax is:
WillPaginate::ActionView::BootstrapLinkRenderer

Thanks for your plugin.

README update

Hi, many thanks for the gem.
Is it possible to update the Alignment (Bootstrap 4 only) example? The class d-flex is required in order to make it working.

<%= will_paginate(@things, :renderer => WillPaginate::ActionView::Bootstrap4LinkRenderer, class: 'd-flex justify-content-center') %>

Mauro

Match Bootstrap Versioning

I think I will match the gem version number of this to the version number of Twitter Bootstrap, and keep the Rubygems version matched to the current public release of Bootstrap.

Hope to have time to work on this soon.

Multiple elements with pagination class

I'm getting the following html output:

<div class="pagination">
  <ul class="pagination">
    <li class="prev previous_page disabled"><a href="#">«</a></li> 
    ...
    <li class="next next_page "><a rel="next" href="/users?page=2">»</a></li>
  </ul>
</div>

but with bootstrap 3 this is causing a huge gap around the pagination because of the nested elements with the pagination class applied so they are both getting a 20px top and bottom margin.

Is this supposed to happen?

Thanks

Col

undefined method `total_pages' for nil:NilClass

I get the error undefined method 'total_pages' for nil:NilClass when leaving off an explicit argument to will_paginate. In other words, if @users contains a (paginated) list of users on the Users index page, the code

<%= will_paginate(@users) %>

works fine, but the equivalent code

<%= will_paginate %>

raises the error above.

I'm considering bootstrap-will_paginate for inclusion in the Ruby on Rails Tutorial, 2nd Edition, so it would be awesome if you could fix this issue, for the sake of newbies everywhere.

Rails doesn't boot with gem 'bootstrap-will_paginate' AND 'mongoid'

rails server
/home/andey/.rvm/gems/ruby-2.0.0-p247/gems/leshill-will_paginate-2.3.11/lib/will_paginate.rb:78:in `extend': wrong argument type Class (expected Module) (TypeError)
    from /home/andey/.rvm/gems/ruby-2.0.0-p247/gems/leshill-will_paginate-2.3.11/lib/will_paginate.rb:78:in `<module:Deprecation>'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247/gems/leshill-will_paginate-2.3.11/lib/will_paginate.rb:77:in `<module:WillPaginate>'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247/gems/leshill-will_paginate-2.3.11/lib/will_paginate.rb:11:in `<top (required)>'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/andey/Dropbox/Projects/bestofama/config/application.rb:6:in `<top (required)>'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
    from /home/andey/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

the gem 'will_paginate' itself has no complications with mongoid.

Next/previous links are still clickable on first, last and current page

Using Rails 5.1.2 and will_paginate 3.1.6 it seems that even when a user is on the last/first page of the dataset, next and previous links are still clickable and generate an ajax request(using turbolinks).

disabled_link

Next may look to be disabled but the ajax request goes through nonetheless.

This is a look at Chrome inspector.

disabled_link_users

Is this behavior intentional?

EDIT: I've found a workaround to get the behavior I want by setting the following in my css:

.disabled {
  pointer-events: none;
}

but it's probably not the proper way to do it.

Related to: mislav/will_paginate#551

Any better ideas?

Carousel Conflicts

It seems the classes used by this gem conflict with the carousel classes. This can easily be reproduced by placing some pagination inside a carousel item. Bootstrap's carousel class also defines things like active, previous and next buttons.

undefined method `paginate'

I'm using Rails 3.2.1. Not sure what is causing the error undefined method 'paginate' for #<Class:0x007fd95430ddf8>. Restarted the server, rechecked everything, still not working.

Move to central organisation?

Hi!

I am the maintainer of three gems similar to this one that make it easier to use Twitter Bootstrap in Ruby projects (https://github.com/krautcomputing/rails-bootstrap-navbar, https://github.com/krautcomputing/bootstrap-navbar, https://github.com/krautcomputing/middleman-bootstrap-navbar).

I was thinking about moving all those gems to a separate organisation (like "bootstrap-ruby") and wanted to get some feedback from other maintainers of similar gems (and the community at large) if that makes sense and if we could use this to make it easier for people to find gems to work with Bootstrap in Ruby (Rails, Sinatra, etc.)
I think it would also invite other people to contribute to those projects if they were united in a central organisation.

What do you think?
Would you be willing to move this repo to such an organisation as well?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.