diff --git a/src/index.html b/src/index.html index d1549a0..0dc7c81 100644 --- a/src/index.html +++ b/src/index.html @@ -58,6 +58,7 @@ + diff --git a/src/scripts/utils.js b/src/scripts/utils.js index 79056bb..2fcca52 100644 --- a/src/scripts/utils.js +++ b/src/scripts/utils.js @@ -71,4 +71,28 @@ registryUI.getPage = function(elts, page, limit) { if (!limit) { limit = 100; } if (!elts) { return []; } return elts.slice(page * limit, limit); +} + +registryUI.getNumPages = function(elts, limit) { + if (!limit) { limit = 100; } + if (!elts) { return 0; } + return Math.trunc((elts.length / limit) % 10); +} + +registryUI.getPageLabels = function(page, nPages) { + var pageLabels = []; + var maxItems = 10; + if (nPages === 0) { return pageLabels; } + if (page !== 0 && nPages >= maxItems) { + pageLabels.push({'icon': 'first_page', page: 0}); + pageLabels.push({'icon': 'chevron_left', page: page - 1}); + } + for (var i = Math.max(1, page - maxItems); i <= Math.min(nPages, page + maxItems); i++) { + pageLabels.push({page: i}); + } + if (page !== nPages && nPages >= maxItems) { + pageLabels.push({'icon': 'chevron_right', page: nPages}); + pageLabels.push({'icon': 'last_page', page: 0}); + } + return pageLabels; } \ No newline at end of file diff --git a/src/style.css b/src/style.css index 145b89c..3abe299 100644 --- a/src/style.css +++ b/src/style.css @@ -48,16 +48,22 @@ main { font-weight: inherit; } -material-card { - min-height: 200px; +material-card, pagination .conatianer { max-width: 75%; margin: auto; margin-top: 20px; margin-bottom: 20px; } -material-card.header { - min-height: auto; +pagination .conatianer { + display: flex; + display: -moz-flex; + display: -webkit-flex; + display: -ms-flexbox; +} + +pagination .conatianer .pagination-centered { + margin: auto; } @media screen and (max-width: 950px){ @@ -216,12 +222,14 @@ material-card table th { } material-card material-button:hover, -material-card table tbody tr:hover { +material-card table tbody tr:hover, +pagination material-button:hover { background-color: #eee; } material-card material-button, -material-card table tbody tr { +material-card table tbody tr, +pagination material-button { transition-duration: .28s; transition-timing-function: cubic-bezier(.4, 0, .2, 1); transition-property: background-color; @@ -330,7 +338,8 @@ dropdown-item, #menu-control-dropdown p { background-color: #e0e0e0; } -material-popup material-button { +material-popup material-button, +pagination material-button { background-color: #fff; color: #000; } @@ -449,7 +458,8 @@ tag-history-button button { border: none; } -material-card material-button { +material-card material-button, +pagination material-button { max-height: 30px; max-width: 30px; } @@ -458,7 +468,8 @@ material-button:hover material-waves { background: none; } -material-card material-button { +material-card material-button, +pagination material-button { background-color: inherit; } @@ -510,4 +521,8 @@ material-checkbox .checkbox { material-checkbox .checkbox.checked { background-color: #777; +} + +pagination material-button { + padding: 0.2em 0.75em; } \ No newline at end of file diff --git a/src/tags/pagination.tag b/src/tags/pagination.tag new file mode 100644 index 0000000..97c0a6d --- /dev/null +++ b/src/tags/pagination.tag @@ -0,0 +1,31 @@ + + + +
+
+ + { p.icon } +
{ p.page }
+
+
+
+ + + \ No newline at end of file diff --git a/src/tags/taglist.tag b/src/tags/taglist.tag index 90248c1..4208cc9 100644 --- a/src/tags/taglist.tag +++ b/src/tags/taglist.tag @@ -30,6 +30,7 @@ along with this program. If not, see .
+ @@ -76,6 +77,7 @@ along with this program. If not, see .
+