From 8392838bd244e822766a8a7b0e14d9c4f2d95739 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 15 Jul 2015 19:06:42 -0400 Subject: [PATCH] paginator: page number --- lib/persona.js | 14 +++++++++++++- modules.less | 3 ++- modules/paginator.less | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 modules/paginator.less diff --git a/lib/persona.js b/lib/persona.js index 1d9a898..08776dd 100644 --- a/lib/persona.js +++ b/lib/persona.js @@ -5,6 +5,7 @@ $(document).ready(function() { setupSlideMenu(); setupEditedByIcon(); + setupPaginator(); var env = utils.findBootstrapEnvironment(); @@ -95,7 +96,7 @@ $(document).ready(function() { function setupEditedByIcon() { function activateEditedTooltips() { $('[data-pid] [component="post/editor"]').each(function() { - var el = $(this); + var el = $(this), icon; if (!el.attr('data-editor')) { return; @@ -118,5 +119,16 @@ $(document).ready(function() { $(window).on('action:posts.loaded', activateEditedTooltips); } + function setupPaginator() { + function appendPageNumber(ev, data) { + var el = data.after ? data.after : data.before, + page = Math.ceil((el.attr('data-index') - 1) / config.postsPerPage); + + el.append('
' + page + '
'); + } + + $(window).on('action:posts.loading', appendPageNumber); + } + }); \ No newline at end of file diff --git a/modules.less b/modules.less index 5f41036..ec1d8e7 100644 --- a/modules.less +++ b/modules.less @@ -1,2 +1,3 @@ @import "modules/taskbar"; -@import "modules/alerts"; \ No newline at end of file +@import "modules/alerts"; +@import "modules/paginator"; \ No newline at end of file diff --git a/modules/paginator.less b/modules/paginator.less new file mode 100644 index 0000000..a5cb9fb --- /dev/null +++ b/modules/paginator.less @@ -0,0 +1,15 @@ +.topic { + .page-number { + position: absolute; + bottom: 6px; + right: 100px; + background: rgb(219, 68, 55); + padding: 4px; + width: 26px; + height: 26px; + text-align: center; + border-radius: 50%; + color: white; + font-size: 11px; + } +} \ No newline at end of file