I’ve been working on a new node.js application for the last few weeks. It uses LDC Via as a back end, but that is by the by. On the front end I am rendering HTML using Jade and Bootstrap.
As I have the need to display quite a lot of data, I’m using Bootstrap pagination and had need to make a re-usable “mixin” that I can insert into many different pages. There are a few examples out there on t’internet that do this, but none that did exactly what I needed, so I’ve created by own.
To use it you just enter something like this in your Jade template:
– var pages = 10
– var currentpage = 3
+pagination(1, pages, currentpage, ‘/index/’)
And you end up with a pagination control that looks like this: