Bugzilla – Attachment 133029 Details for
Bug 29723
Add a "Configure table" button for KohaTable tables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29723: Add a "Configure table" button for KohaTable tables
Bug-29723-Add-a-Configure-table-button-for-KohaTab.patch (text/plain), 6.31 KB, created by
Jonathan Druart
on 2022-04-06 13:52:15 UTC
(
hide
)
Description:
Bug 29723: Add a "Configure table" button for KohaTable tables
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-04-06 13:52:15 UTC
Size:
6.31 KB
patch
obsolete
>From d1ba35dffe8e55cc1972f12be33c6167f898811f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 17 Dec 2021 10:19:35 +0100 >Subject: [PATCH] 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? >--- > Koha/Template/Plugin/TablesSettings.pm | 8 +++++++- > admin/columns_settings.pl | 4 ++-- > .../prog/en/includes/columns_settings.inc | 11 +++++++++++ > .../intranet-tmpl/prog/en/includes/doc-head-close.inc | 5 +++++ > .../prog/en/modules/admin/columns_settings.tt | 7 +++++-- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 11 +++++++++++ > 6 files changed, 41 insertions(+), 5 deletions(-) > >diff --git a/Koha/Template/Plugin/TablesSettings.pm b/Koha/Template/Plugin/TablesSettings.pm >index 720b67445ac..2eb443f74e3 100644 >--- a/Koha/Template/Plugin/TablesSettings.pm >+++ b/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 || {} ) >diff --git a/admin/columns_settings.pl b/admin/columns_settings.pl >index d5b0df9dca7..6feb2540a01 100755 >--- a/admin/columns_settings.pl >+++ b/admin/columns_settings.pl >@@ -74,8 +74,8 @@ if ( $action eq 'save' ) { > if ( $action eq 'list' ) { > my $modules = C4::Utils::DataTables::TablesSettings::get_modules; > $template->param( >- panel => ( $input->param('panel') || 0 ), >- modules => $modules, >+ module_tab => scalar $input->param('module'), >+ modules => $modules, > ); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >index 4d05f65bcd2..50d54e86e79 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >@@ -153,6 +153,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 >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >index 8f42529cf74..4ab3ea99952 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >@@ -25,6 +25,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' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >index 5db60d762c1..516ed2b390a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >@@ -3,19 +3,22 @@ > [% USE TablesSettings %] > [% SET footerjs = 1 %] > [% SET panel_id = 0 %] >+[% SET panel = 0 %] > [% BLOCK pagelist %] > [% IF module.keys and module.keys.size > 0 %] > Jump to: > [% FOR pagename IN module.keys.sort %] >- <a href="#[% pagename | url %]">[% pagename | html %]</a> >+ <a href="#[% modulename | url %]_[% pagename | url %]">[% pagename | html %]</a> > [% UNLESS loop.last %]<span class="separator"> | </span>[% END %] > [% END %] > [% END %] >+ [% IF module_tab && module_tab == modulename %] >+ [% panel = panel_id %] >+ [% END %] > <div class="pagelist"> > <form method="post" action="/cgi-bin/koha/admin/columns_settings.pl"> > <input type="hidden" name="action" value="save" /> > <input type="hidden" name="module" value="[% modulename | html %]" /> >- <input type="hidden" name="panel" value="[% panel_id | html %]" /> > [% SET panel_id = panel_id + 1 %] > [% IF module.keys and module.keys.size > 0 %] > [% FOR pagename IN module.keys.sort %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 3f28a83bb67..637e50c17dd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -797,6 +797,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 ) { >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29723
:
128648
|
131874
|
133029
|
138951
|
138952
|
138972
|
138973
|
138974
|
138975
|
138985
|
138986
|
138987
|
138988
|
138989
|
138992
|
138993
|
138994
|
138995
|
138996
|
138997
|
138998
|
138999
|
139000
|
139002
|
139003
|
139004
|
139005
|
139006
|
139194