Bugzilla – Attachment 47689 Details for
Bug 15285
Upgrade DataTables to 1.10.10 or later
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15285: Update common files
Bug-15285-Update-common-files.patch (text/plain), 5.03 KB, created by
Kyle M Hall (khall)
on 2016-02-05 12:13:48 UTC
(
hide
)
Description:
Bug 15285: Update common files
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-02-05 12:13:48 UTC
Size:
5.03 KB
patch
obsolete
>From 363f20e1fae3db1f317ce0540168e8f47cf22871 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 14 Dec 2015 12:17:43 +0000 >Subject: [PATCH] Bug 15285: Update common files >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch moves the Button area all tables which does not redefine the >dom/sDom DT parameter. > >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Utils/DataTables/ColumnsSettings.pm | 13 ++++++++++++- > .../prog/en/includes/columns_settings.inc | 18 ++++++++++++------ > .../intranet-tmpl/prog/en/includes/datatables.inc | 2 ++ > koha-tmpl/intranet-tmpl/prog/en/js/datatables.js | 2 +- > 4 files changed, 27 insertions(+), 8 deletions(-) > >diff --git a/C4/Utils/DataTables/ColumnsSettings.pm b/C4/Utils/DataTables/ColumnsSettings.pm >index eb0ca54..6a804c4 100644 >--- a/C4/Utils/DataTables/ColumnsSettings.pm >+++ b/C4/Utils/DataTables/ColumnsSettings.pm >@@ -44,7 +44,18 @@ sub get_columns { > $column->{cannot_be_toggled} = $c->cannot_be_toggled; > } > >- return $list->{modules}{$module}{$page}{$tablename} || []; >+ my $columns = $list->{modules}{$module}{$page}{$tablename} || []; >+ >+ # Assign default value if does not exist >+ $columns = [ map { >+ { >+ cannot_be_toggled => exists $_->{cannot_be_toggled} ? $_->{cannot_be_toggled} : 0, >+ is_hidden => exists $_->{is_hidden} ? $_->{is_hidden} : 0, >+ columnname => $_->{columnname}, >+ } >+ } @$columns ]; >+ >+ return $columns; > } > > sub get_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 ec86690..7d80435 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >@@ -1,13 +1,14 @@ > [% USE ColumnsSettings %] > >-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.colvis.css" /> >-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.colvis.js"></script> >+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/buttons.dataTables.min.css" /> >+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/dataTables.buttons.min.js"></script> >+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/buttons.colVis.min.js"></script> > > <script type="text/javascript"> > function KohaTable(selector, dt_parameters, columns_settings) { > var id = 0; > var hidden_ids = []; >- var excluded_ids = []; >+ var included_ids = []; > $(columns_settings).each( function() { > var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( 'th' ); > var used_id = dt_parameters.bKohaColumnsUseNames ? named_id : id; >@@ -16,12 +17,17 @@ function KohaTable(selector, dt_parameters, columns_settings) { > if ( this['is_hidden'] == "1" ) { > hidden_ids.push( used_id ); > } >- if ( this['cannot_be_toggled'] == "1" ) { >- excluded_ids.push( used_id ); >+ if ( this['cannot_be_toggled'] == "0" ) { >+ included_ids.push( used_id ); > } > id++; > }); >- dt_parameters[ "oColVis" ] = { "aiExclude": excluded_ids }; >+ dt_parameters[ "buttons" ] = [ >+ { >+ extend: 'colvis', >+ columns: included_ids, >+ } >+ ]; > var table = $(selector).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters)); > > $(hidden_ids).each(function(index, value) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc >index 4381b01..590fae5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/datatables.inc >@@ -1,5 +1,7 @@ > [% INCLUDE 'format_price.inc' %] > <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> >+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/dataTables.buttons.min.js"></script> >+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/buttons.colVis.min.js"></script> > <script type="text/javascript"> > //<![CDATA[ > var MSG_DT_FIRST = _("First"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >index f1623dc..71185c6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >@@ -23,7 +23,7 @@ var dataTablesDefaults = { > "sSearch" : window.MSG_DT_SEARCH || "Search:", > "sZeroRecords" : window.MSG_DT_ZERO_RECORDS || "No matching records found" > }, >- "sDom": 'C<"top pager"ilpf>tr<"bottom pager"ip>', >+ "dom": '<"top pager"ilpfB>tr<"bottom pager"ip>', > "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, window.MSG_DT_ALL || "All"]], > "iDisplayLength": 20 > }; >-- >2.1.4
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 15285
:
45639
|
45640
|
45641
|
46484
|
46485
|
46683
|
46686
|
47261
|
47263
|
47264
|
47266
|
47688
| 47689 |
47690
|
47691