From 4364b1666e85eb4d2e38184a7dcd1bd64826c8ff Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 24 Apr 2020 11:50:04 -0300 Subject: [PATCH] Bug 25279: Use the API to list cities This patch makes the general cities datatable use the API for rendering. To test: 1. Test the datatable behaviour 2. Apply this patch 3. Repeat your tests => SUCCESS: Things work! Filtering and sorting specially Bonus: Use the browser inspector to notice each interaction with the datatable triggers an API call with the right query parameters Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- admin/cities.pl | 5 - .../prog/en/modules/admin/cities.tt | 98 +++++++++++-------- 2 files changed, 57 insertions(+), 46 deletions(-) diff --git a/admin/cities.pl b/admin/cities.pl index de86112797..f25ec18571 100755 --- a/admin/cities.pl +++ b/admin/cities.pl @@ -101,11 +101,6 @@ if ( $op eq 'add_form' ) { $op = 'list'; } -if ( $op eq 'list' ) { - my $cities = Koha::Cities->search( { city_name => { -like => "%$searchfield%" } } ); - $template->param( cities => $cities, ); -} - $template->param( cityid => $cityid, searchfield => $searchfield, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt index f4ec95d825..3b33747ff3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt @@ -133,39 +133,18 @@ Searching: [% searchfield | html %] [% END %] - [% IF cities.count %] - - - - - - - - - - - - - [% FOREACH city IN cities %] - - - - - - - - - [% END %] - -
City IDCityStateZIP/Postal codeCountryActions
[% city.cityid | html %][% city.city_name | html %][% city.city_state | html %][% city.city_zipcode | html %][% city.city_country | html %] - Edit - Delete -
- [% ELSE %] -
- There are no cities defined. Create a new city. -
- [% END %] + + + + + + + + + + + +
City IDCityStateZIP/Postal codeCountryActions
[% END %] @@ -183,14 +162,51 @@ [% INCLUDE 'datatables.inc' %] [% END %] -- 2.39.5