Browse Source

Bug 29723: Add a "Configure table" button for KohaTable tables

This patch suggests to have a "Configure table" button when a table can
be configured in the "Table settings" administraition area.

Test plan:
Go to different views where the table can be configured (you an
exhaustive list on bug 29648), notice the "Configure table" button (if
you have the 'manage_column_config' subpermission.

Note that the link is correct but the scrollbar is not adjusted at the
correct position. Maybe we could improve that switching to the bootstrap
accordion plugin?

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Andrew <andrewfh@dubcolib.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
22.11.x
Jonathan Druart 2 years ago
committed by Tomas Cohen Arazi
parent
commit
73178317a6
Signed by: tomascohen GPG Key ID: 0A272EA1B2F3C15F
  1. 8
      Koha/Template/Plugin/TablesSettings.pm
  2. 11
      koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc
  3. 5
      koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
  4. 11
      koha-tmpl/intranet-tmpl/prog/js/datatables.js

8
Koha/Template/Plugin/TablesSettings.pm

@ -134,7 +134,13 @@ sub GetTableSettings {
my $settings = C4::Utils::DataTables::TablesSettings::get_table_settings( $module, $page, $table );
my $columns = C4::Utils::DataTables::TablesSettings::get_columns( $module, $page, $table );
$settings->{columns} = $columns;
$settings = {
%$settings,
columns => $columns,
module => $module,
page => $page,
table => $table,
};
return $format eq 'json'
? to_json( $settings || {} )

11
koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc

@ -161,6 +161,17 @@ function KohaTable(id_selector, dt_parameters, table_settings, add_filters) {
}
);
if ( CAN_user_parameters_manage_column_config ) {
dt_parameters[ "buttons" ].push(
{
text: 'Configure this table',
action: function() {
window.location = '/cgi-bin/koha/admin/columns_settings.pl?module=' + table_settings['module'] + '#' + table_settings['page'] + '#' + table_settings['table'];
},
}
);
}
var table = $(selector);
if ( add_filters ) {
// Duplicate the table header row for columnFilter

5
koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc

@ -29,6 +29,11 @@
<script>
var Koha = {};
[% IF CAN_user_parameters_manage_column_config %]
var CAN_user_parameters_manage_column_config = 1;
[% ELSE %]
var CAN_user_parameters_manage_column_config = 0;
[% END %]
</script>
[% IF lang && lang != 'en' %]

11
koha-tmpl/intranet-tmpl/prog/js/datatables.js

@ -813,6 +813,17 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
}
);
if ( CAN_user_parameters_manage_column_config ) {
settings[ "buttons" ].push(
{
text: 'Configure this table',
action: function() {
window.location = '/cgi-bin/koha/admin/columns_settings.pl?module=' + table_settings['module'] + '#' + table_settings['page'] + '#' + table_settings['table'];
},
}
);
}
$(".dt_button_clear_filter, .columns_controls, .export_controls").tooltip();
if ( add_filters ) {

Loading…
Cancel
Save