Bug 27465: Add column visibility to admin/cities.pl
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 18 Jan 2021 15:18:09 +0000 (16:18 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 21 Apr 2021 13:25:07 +0000 (15:25 +0200)
We want admin/cities.pl to be using as much DT features as possible to be used as an example.

Test plan:
Add some cities, go to admin/cities.pl confirm that you can show/hide
column.

Go to the tables settings admin page and confirm that you can set some
default settings from there.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
admin/columns_settings.yml
koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt

index 60107a6..2bc56bf 100644 (file)
@@ -155,6 +155,23 @@ modules:
               cannot_be_toggled: 1
               cannot_be_modified: 1
   admin:
+    cities:
+      table_cities:
+        columns:
+            -
+              columnname: city_id
+            -
+              columnname: city_name
+            -
+              columnname: city_state
+            -
+              columnname: city_zipcode
+            -
+              columnname: city_country
+            -
+              columnname: actions
+              cannot_be_toggled: 1
+              cannot_be_modified: 1
     currency:
       currencies-table:
         columns:
index f31f9c7..cd0da5d 100644 (file)
@@ -1,6 +1,7 @@
 [% USE raw %]
 [% USE Asset %]
 [% SET footerjs = 1 %]
+[% USE TablesSettings %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>
     [% IF op =='add_form' %]
 [% MACRO jsinclude BLOCK %]
     [% Asset.js("js/admin-menu.js") | $raw %]
     [% INCLUDE 'datatables.inc' %]
+    [% INCLUDE 'columns_settings.inc' %]
     <script>
 
+        var columns_settings = [% TablesSettings.GetColumns( 'admin', 'cities', 'table_cities', 'json' ) | $raw %];
         $(document).ready(function() {
             var cities_table_url = '/api/v1/cities?';
 
                         "orderable": false
                     }
                 ]
-            }, [], 1);
+            }, columns_settings, 1);
 
         });
     </script>