Coder Social home page Coder Social logo

maebeale / will_paginate-bootstrap5 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bootstrap-ruby/will_paginate-bootstrap

0.0 0.0 0.0 46 KB

Integrates Bootstrap pagination component with will_paginate

License: MIT License

Ruby 82.07% SCSS 17.93%

will_paginate-bootstrap5's Introduction

will_paginate-bootstrap5


This is a fork of the original will_paginate-bootstrap gem (thank you for the 10 years I used this gem, btw!!!).

The original gem is no longer maintained, so this fork allows me to ensure usage of the LinkRenderer.

Rails 7+'s new built-in pagination offers the paginate method (and more), but seems to not yet include a defined LinkRenderer.


Code Climate

Bootstrap Pagination Component

This gem integrates the Bootstrap pagination component with the will_paginate pagination gem.

Just like will_paginate, Rails and Sinatra are supported.

Install

  • For projects using Bundler (like Rails 7+):
    • add gem 'will_paginate-bootstrap5' to Gemfile (and then run bundle install).
      • (this works without needing to add gem 'will_paginate' to Gemfile)
  • Otherwise:
    • gem install will_paginate-bootstrap5

Usage

Rails

  1. Add Bootstrap CSS to your project
    • For Rails 7+ projects, use one of the following options:
      • install the boostrap gem
      • manually download bootstrap.css from the bootstrap website and save it under [your repo]/vendor/assets/stylesheets
        • add //= link_tree ../../../vendor/assets/stylesheets .css to app/assets/config/manifest.js so it gets compiled by sprockets/asset pipeline
      • add bootstrap's CDN url within the <head> of your app/views/layout.html.erb
      • pin the CDN in your config/importmap.rb
  2. In your view, use the renderer: BootstrapPagination::Rails option with the will_paginate helper, for example:
<%= will_paginate @collection, renderer: BootstrapPagination::Rails %>

Sinatra

  1. Load the Bootstrap CSS in your template.
  2. require "will_paginate-bootstrap" in your Sinatra app.
  3. In your view, use the renderer: BootstrapPagination::Sinatra option with the will_paginate helper, for example:
<%= will_paginate @collection, renderer: BootstrapPagination::Sinatra %>

Compatibility

Starting at version 1.0, this gem no longer supports Bootstrap 2.

Ruby >= 1.9.2
will_paginate >= 3.0.3
Bootstrap >= 5.0.0

Bootstrap 2 users can use version 0.2.5 of the original gem, which was the last version to offer Bootstrap 2 support.

will_paginate-bootstrap5's People

Contributors

nickpad avatar maebeale avatar f3ndot avatar acrogenesis avatar abloom avatar foobear avatar kalmanh avatar manuelmeurer avatar sigmike avatar juniorz avatar tkrajcar avatar edatrix avatar

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.