@@ -, +, @@ - Under each tab, the table of suggestions should have a DataTables toolbar with export and columns buttons. These controls should work correctly: - Showing and hiding columns should work as expected - Exports should work, excluding the first and last columns - Test the tables when using the various "Organize by" settings. - Test changing the settings in Administration -> Columns settings. - Verify that the changes you make to that configuration are reflected in the suggestions tables. --- admin/columns_settings.yml | 27 ++++++++++++++ .../prog/en/modules/suggestion/suggestion.tt | 42 ++++++++++++---------- 2 files changed, 50 insertions(+), 19 deletions(-) --- a/admin/columns_settings.yml +++ a/admin/columns_settings.yml @@ -101,6 +101,33 @@ modules: cannot_be_toggled: 1 cannot_be_modified: 1 + suggestions: + suggestions: + - + columnname: selections + cannot_be_toggled: 1 + cannot_be_modified: 1 + - + columnname: suggestion + - + columnname: suggested_by + - + columnname: suggested_on + - + columnname: managed_by + - + columnname: managed_on + - + columnname: library + - + columnname: library_fund + - + columnname: suggestion_status + - + columnname: actions + cannot_be_toggled: 1 + cannot_be_modified: 1 + admin: currency: currencies-table: --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -4,6 +4,7 @@ [% USE AuthorisedValues %] [% USE KohaDates %] [% USE Price %] +[% USE ColumnsSettings %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › @@ -501,7 +502,7 @@ <table id="[% suggestion.suggestiontype | html %]t" class="sorted"> <thead> <tr> - <th class="NoSort"> </th> + <th class="NoSort noExport"> </th> <th class="anti-the">Suggestion</th> <th>Suggested by</th> <th>Suggested on</th> @@ -510,7 +511,7 @@ <th>Library</th> <th>Fund</th> <th>Status</th> - <th class="NoSort"> </th> + <th class="NoSort noExport"> </th> </tr> </thead> <tbody> @@ -810,7 +811,7 @@ [% MACRO jsinclude BLOCK %] [% INCLUDE 'calendar.inc' %] [% IF ( op == 'show' || op_else ) %] - <script type="text/javascript"> + <script> $(document).ready(function(){ $(".deletesuggestion").on("click",function(){ return confirm(_("Are you sure you want to delete this suggestion?")); @@ -820,8 +821,9 @@ [% END %] [% IF ( op_else ) %] [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %] [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] - <script type="text/javascript"> + <script> /** * displayOther. * This function display the select or an textaera to write a reason. @@ -831,20 +833,22 @@ $("#"+show+id).show(); } $(document).ready(function() { - $('#suggestiontabs').tabs({ - // Correct table sizing for tables hidden in tabs - // http://www.datatables.net/examples/api/tabs_and_scrolling.html - "activate": function(event, ui) { - $( $.fn.dataTable.tables( true ) ).DataTable().columns.adjust(); - } - }); - $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, { - "aoColumnDefs": [ - { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, - { "sType": "anti-the", "aTargets" : [ "anti-the" ] } - ], - "sPaginationType": "full" - })); + $('#suggestiontabs').tabs(); + + columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'suggestions', 'suggestions', 'json' ) | $raw %] + [% FOREACH suggestion IN suggestions %] + [% IF ( suggestion.suggestions_loop ) %] + KohaTable("[% suggestion.suggestiontype %]t", { + "sorting": [[ 1, "asc" ]], + "autoWidth": false, + "columnDefs": [ + { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] }, + { "sType": "anti-the", "aTargets" : [ "anti-the" ] }, + ] + }, columns_settings ); + [% END %] + [% END %] + [% FOREACH suggestion IN suggestions %] // functions for [% suggestion.suggestiontype | html %] interactions $("#CheckAll[% suggestion.suggestiontype | html %]").click(function(e){ @@ -948,7 +952,7 @@ </script> [% END %] [% IF ( op_save ) %] - <script type="text/javascript"> + <script> $(document).ready(function(){ calcNewsuggTotal(); $("#quantity,#price,#currency").on("change",function(){ --