Skip to content

Instantly share code, notes, and snippets.

@dhigginbotham
Created July 5, 2014 19:28
Show Gist options
  • Save dhigginbotham/50f2bb66b5f521aaede7 to your computer and use it in GitHub Desktop.
Save dhigginbotham/50f2bb66b5f521aaede7 to your computer and use it in GitHub Desktop.
mixin pagination(current, total, limit)
- limit = limit || 40;
- current = current+1;
- total = Math.ceil(total / limit);
- prev = (current <= 1 ? 1 : current);
- next = (current + 1);
ul.pagination.pagination-sm
li: a(href="?page=#{prev}") «
- for(var i=0;i<total;++i)
if (current == (i + 1))
li.active: a(href="#") #{i + 1}
else
li: a(href="?page=#{i + 1}") #{i + 1}
li: a(href="?page=#{next}") »
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment