From 5b6fb40914b98ea594417dcdf319d98abd19a0b4 Mon Sep 17 00:00:00 2001 From: totoro Date: Sun, 16 Oct 2022 20:02:30 +0200 Subject: [PATCH] add current_page, total_page and total_items in control_panel_pager --- web/widgets/pager.anubis | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/web/widgets/pager.anubis b/web/widgets/pager.anubis index 3a7c40f..0defd05 100644 --- a/web/widgets/pager.anubis +++ b/web/widgets/pager.anubis @@ -13,24 +13,38 @@ public define HTML_Partial_Content control_panel_pager ( String pager_id, + Int current_page, + Int total_page, + Int total_items, String previous, String next ) = partial_content([js(js_file("xlib/js/pager.js"))], div(id(pager_id), [ - text(class("o_pager_current_page"),"0"), + text(class("o_pager_current_page"), current_page), text("/"), - text(class("o_pager_total_page"),"0"), + text(class("o_pager_total_page"), total_page), text(" "), - text(class("o_pager_total_items"),"0"), + text(class("o_pager_total_items"), total_items), span(class("btn-group btn-group-sm"), [ - button([class("fa fa-chevron-left btn btn-icon o_pager_previous"), attr("type","button"), accesskey('p'), event(onclick, previous)]), - button([class("fa fa-chevron-right btn btn-icon o_pager_next"), attr("type","button"), accesskey('n'), event(onclick, next)]) + button([class("fa fa-chevron-left btn btn-icon o_pager_previous"), attr("type","button"), bool_attr(current_page = 1, "disabled"), accesskey('p'), event(onclick, previous)]), + button([class("fa fa-chevron-right btn btn-icon o_pager_next"), attr("type","button"), bool_attr(current_page = total_page, "disabled"), accesskey('n'), event(onclick, next)]) ]) ])) . +public define HTML_Partial_Content + control_panel_pager + ( + String pager_id, + String previous, + String next + ) + = + control_panel_pager(pager_id, 0, 0, 0, previous, next) +. + public define HTML_Head_Tag update_pager_script ( -- libgit2 0.21.4