Commit 5b6fb40914b98ea594417dcdf319d98abd19a0b4
1 parent
d1b5d85b
add current_page, total_page and total_items in control_panel_pager
Showing
1 changed file
with
19 additions
and
5 deletions
Show diff stats
web/widgets/pager.anubis
| @@ -13,24 +13,38 @@ public define HTML_Partial_Content | @@ -13,24 +13,38 @@ public define HTML_Partial_Content | ||
| 13 | control_panel_pager | 13 | control_panel_pager |
| 14 | ( | 14 | ( |
| 15 | String pager_id, | 15 | String pager_id, |
| 16 | + Int current_page, | ||
| 17 | + Int total_page, | ||
| 18 | + Int total_items, | ||
| 16 | String previous, | 19 | String previous, |
| 17 | String next | 20 | String next |
| 18 | ) | 21 | ) |
| 19 | = | 22 | = |
| 20 | partial_content([js(js_file("xlib/js/pager.js"))], | 23 | partial_content([js(js_file("xlib/js/pager.js"))], |
| 21 | div(id(pager_id), [ | 24 | div(id(pager_id), [ |
| 22 | - text(class("o_pager_current_page"),"0"), | 25 | + text(class("o_pager_current_page"), current_page), |
| 23 | text("/"), | 26 | text("/"), |
| 24 | - text(class("o_pager_total_page"),"0"), | 27 | + text(class("o_pager_total_page"), total_page), |
| 25 | text(" "), | 28 | text(" "), |
| 26 | - text(class("o_pager_total_items"),"0"), | 29 | + text(class("o_pager_total_items"), total_items), |
| 27 | span(class("btn-group btn-group-sm"), [ | 30 | span(class("btn-group btn-group-sm"), [ |
| 28 | - button([class("fa fa-chevron-left btn btn-icon o_pager_previous"), attr("type","button"), accesskey('p'), event(onclick, previous)]), | ||
| 29 | - button([class("fa fa-chevron-right btn btn-icon o_pager_next"), attr("type","button"), accesskey('n'), event(onclick, next)]) | 31 | + 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)]), |
| 32 | + 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)]) | ||
| 30 | ]) | 33 | ]) |
| 31 | ])) | 34 | ])) |
| 32 | . | 35 | . |
| 33 | 36 | ||
| 37 | +public define HTML_Partial_Content | ||
| 38 | + control_panel_pager | ||
| 39 | + ( | ||
| 40 | + String pager_id, | ||
| 41 | + String previous, | ||
| 42 | + String next | ||
| 43 | + ) | ||
| 44 | + = | ||
| 45 | + control_panel_pager(pager_id, 0, 0, 0, previous, next) | ||
| 46 | +. | ||
| 47 | + | ||
| 34 | public define HTML_Head_Tag | 48 | public define HTML_Head_Tag |
| 35 | update_pager_script | 49 | update_pager_script |
| 36 | ( | 50 | ( |