From 489297deb9331bdacfba11ebced7bebeb9ae2ac2 Mon Sep 17 00:00:00 2001 From: Bofh Date: Mon, 12 Dec 2022 23:47:31 +0100 Subject: [PATCH] Make "paging" visible also on the bottom of the search results * Allow for repeating E.template function by reimplementing base --- js/base.php | 19 +++++++++++-------- js/templates/instance/filter-users.html | 1 + views/instance.php | 3 +++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/js/base.php b/js/base.php index dfc6855..e6b184f 100644 --- a/js/base.php +++ b/js/base.php @@ -42,21 +42,24 @@ var E = { } }, template: function(_id, cback) { - var tpl = E.elemid(_id+'-item'); - if (tpl !== null) { - tpl = tpl.outerHTML; - tpl = tpl.replace('id="'+_id+'-item"','class="item"'); - tpl = tpl.replace('data-src=', 'src='); - } var elem = null; elem = E.elemid(_id); if (elem === null) elem = E.element(_id); if (elem === null) return; - if (typeof cback === 'string') + if (typeof cback === 'string') { elem.innerText = cback; - else elem.innerHTML = cback(tpl); + return; + } + _id = elem.id; + var tpl = E.elemid(_id+'-item'); + if (tpl !== null) { + tpl = tpl.outerHTML; + tpl = tpl.replace('id="'+_id+'-item"','class="item"'); + tpl = tpl.replace('data-src=', 'src='); + elem.innerHTML = cback(tpl); + } }, http_template: function(name, cback) { const slug = 'html_cache__'+name.replaceAll('/','--'); diff --git a/js/templates/instance/filter-users.html b/js/templates/instance/filter-users.html index b1e4087..7430641 100644 --- a/js/templates/instance/filter-users.html +++ b/js/templates/instance/filter-users.html @@ -176,5 +176,6 @@ +

diff --git a/views/instance.php b/views/instance.php index b6d317b..4814920 100644 --- a/views/instance.php +++ b/views/instance.php @@ -255,6 +255,9 @@ window.view.instance = { tpl = tpl.replaceAll('{total_users}', js['total']); return tpl+'
'; }); + E.template('#paging.bottom', function(TPL) { + return E.elemid('paging').innerHTML; + }); }); }, save_filter: function() {