Bugzilla – Attachment 15140 Details for
Bug 9034
Add sorting and filtering on items table (catalogue/detail.pl)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9034: Filters are disabled by default
Bug-9034-Filters-are-disabled-by-default.patch (text/plain), 5.83 KB, created by
Jonathan Druart
on 2013-02-07 14:26:33 UTC
(
hide
)
Description:
Bug 9034: Filters are disabled by default
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-02-07 14:26:33 UTC
Size:
5.83 KB
patch
obsolete
>From 0a04051b1e20267ac7b5b4c59754008aa8b2ed28 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 9 Jan 2013 14:56:43 +0100 >Subject: [PATCH] Bug 9034: Filters are disabled by default > >A small link above the table allow to enable this feature. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >Amended patch: Replace single quote strings with double quote strings >--- > .../prog/en/modules/catalogue/detail.tt | 104 +++++++++++++++----- > 1 file changed, 78 insertions(+), 26 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 1763962..8f40e31 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -52,15 +52,70 @@ function verify_images() { > <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> > <script type="text/javascript"> > //<![CDATA[ >+ function activate_filters(id) { >+ table = $("#" + id + " table"); >+ if (table.length == 1) { >+ filters_row = table.find('thead tr.filters_row'); >+ if (table.find('thead tr.columnFilter').length == 0) { >+ table.dataTable().columnFilter({ >+ 'sPlaceHolder': 'head:after' >+ }); >+ filters_row.addClass('columnFilter'); >+ } >+ filters_row.show(); >+ } >+ >+ $('#' + id + '_activate_filters') >+ .text(_("Deactivate filters")) >+ .unbind('click') >+ .click(function() { >+ deactivate_filters(id); >+ return false; >+ }); >+ } >+ >+ function deactivate_filters(id) { >+ filters_row = $("#" + id + " table").find('thead tr.filters_row'); >+ >+ filters_row.find('input[type="text"]') >+ .val('') // Empty filter text boxes >+ .trigger('keyup') // Filter (display all rows) >+ .trigger('blur'); // Reset value to the column name >+ filters_row.hide(); >+ >+ $('#' + id + '_activate_filters') >+ .text(_("Activate filters")) >+ .unbind('click') >+ .click(function() { >+ activate_filters(id); >+ return false; >+ }); >+ } >+ > $(document).ready(function() { >- for (id in {holdings:0, otherholdings:0}) { >- $("#"+ id +" > table").dataTable($.extend(true, {}, dataTablesDefaults, { >+ var ids = ['holdings', 'otherholdings']; >+ for (var i in ids) { >+ var id = ids[i]; >+ table = $('#' + id + ' table'); >+ >+ // Duplicate the table header row for columnFilter >+ thead_row = table.find('thead tr'); >+ clone = thead_row.clone().addClass('filters_row'); >+ thead_row.before(clone); >+ >+ // Enable sorting >+ table.dataTable($.extend(true, {}, dataTablesDefaults, { > 'sDom': 't', > 'bPaginate': false, > 'bAutoWidth': false >- })).columnFilter({ >- 'sPlaceHolder': 'head:after' >- }); >+ })); >+ >+ // Show a link to activate filtering >+ link = $('<a>') >+ .attr('href', '#') >+ .attr('id', id + '_activate_filters'); >+ table.before(link); >+ deactivate_filters(id); > } > }); > //]]> >@@ -298,27 +353,24 @@ function verify_images() { > [% BLOCK items_table %] > <table> > <thead> >- [%# duplicate the header row for columnFilter %] >- [% FOREACH i IN [1,2] %] >- <tr> >- [% IF ( item_level_itypes ) %]<th>Item type</th>[% END %] >- <th>Current location</th> >- <th>Home Library</th> >- [% IF ( itemdata_ccode ) %]<th>Collection</th>[% END %] >- <th>Call number</th> >- <th>Status</th> >- <th>Last seen</th> >- <th>Barcode</th> >- [% IF ( volinfo ) %]<th>Publication details</th>[% END %] >- [% IF ( itemdata_uri ) %]<th>url</th>[% END %] >- [% IF ( itemdata_copynumber ) %]<th>Copy no.</th>[% END %] >- [% IF materials %]<th>Materials specified</th>[% END %] >- [% IF ( itemdata_itemnotes ) %]<th>Public notes</th>[% END %] >- [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th>Spine label</th>[% END %] >- [% IF ( hostrecords ) %]<th>Host records</th>[% END %] >- [% IF ( analyze ) %]<th>Used in</th><th></th>[% END %] >- </tr> >- [% END %] >+ <tr> >+ [% IF ( item_level_itypes ) %]<th>Item type</th>[% END %] >+ <th>Current location</th> >+ <th>Home Library</th> >+ [% IF ( itemdata_ccode ) %]<th>Collection</th>[% END %] >+ <th>Call number</th> >+ <th>Status</th> >+ <th>Last seen</th> >+ <th>Barcode</th> >+ [% IF ( volinfo ) %]<th>Publication details</th>[% END %] >+ [% IF ( itemdata_uri ) %]<th>url</th>[% END %] >+ [% IF ( itemdata_copynumber ) %]<th>Copy no.</th>[% END %] >+ [% IF materials %]<th>Materials specified</th>[% END %] >+ [% IF ( itemdata_itemnotes ) %]<th>Public notes</th>[% END %] >+ [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th>Spine label</th>[% END %] >+ [% IF ( hostrecords ) %]<th>Host records</th>[% END %] >+ [% IF ( analyze ) %]<th>Used in</th><th></th>[% END %] >+ </tr> > </thead> > <tbody> > [% FOREACH item IN items %] >-- >1.7.10.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 9034
:
13310
|
13338
|
13345
|
13346
|
13368
|
14491
|
14492
|
14493
|
14494
|
14743
|
15137
|
15138
|
15139
| 15140