Code Monkey home page Code Monkey logo

express-handlebars-paginate's Introduction

Express Handlebars Paginate Helper with Twitter Bootstrap Enabled

I have created this template as I wanted to have a paginate template that would work on the fly. I don't want to make our own html for that and can be used as a helper for express handlebars. I hope this would be useful for others as well.

Screenshot

Screenshot

Install

npm install express-handlebars-paginate

Usage

/* ... */

var paginateHelper = require('express-handlebars-paginate');
//Register Helper
Handlebars.registerHelper('paginateHelper', paginateHelper);

###With Handlebars server.js

/* ... */
Handlebars.registerHelper('paginateHelper', paginateHelper);

###With Express Handlebars

/* ... */
hbs.handlebars.registerHelper('paginateHelper', paginateHelper.createPagination);

Send the pagination object in your response or express controller Example:

res.render('renderViewHTML', { pagination: { page: currentPage, limit:PageLimit,totalRows: TotalNoOfROWS }});

Query Parameter : Allows to send query parameters to paginatin

res.render('renderViewHTML', { pagination: { page: currentPage, limit:PageLimit,totalRows: TotalNoOfROWS, queryParams: object }});

Usage in Handlebars Template

{{{paginateHelper pagination}}}

Options

limit

Type: int Default: 7

Allows to define the number of page number limit

{{paginateHelper pagination limit="7"}}

leftText

Type: string Default: <i class="fas fa-angle-left"></i>

Allows to define the text for left link

{{paginateHelper pagination leftText="Prev"}}

rightText

Type: string Default: <i class="fas fa-angle-right"></i>

Allows to define the text for right link

{{paginateHelper pagination rightText="Next"}}

firstText

Type: string Default: <i class="fas fa-angle-double-left"></i>

Allows to define the text for first link

{{paginateHelper pagination firstText="First"}}

lastText

Type: string Default: <i class="fas fa-angle-double-right"></i>

Allows to define the text for last link

{{paginateHelper pagination lastText="Last"}}

paginationClass

Type: string Default: pagination pagination-sm

Allows to define the ul pagination class

{{paginateHelper pagination paginationClass="some class"}}

express-handlebars-paginate's People

Contributors

babiz avatar r3xakead0 avatar amirshakya2010 avatar rssdanielreibl avatar thesuperfly 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.