Bugzilla – Attachment 20921 Details for
Bug 10730
Use DataTables on the tag review page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10730 - Use DataTables on the tag review page
Bug-10730---Use-DataTables-on-the-tag-review-page.patch (text/plain), 9.02 KB, created by
Owen Leonard
on 2013-09-09 16:35:27 UTC
(
hide
)
Description:
Bug 10730 - Use DataTables on the tag review page
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2013-09-09 16:35:27 UTC
Size:
9.02 KB
patch
obsolete
>From cea9a24f02d0caa3866d04ae799b15590622eed6 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 12 Aug 2013 12:31:52 -0400 >Subject: [PATCH] Bug 10730 - Use DataTables on the tag review page >Content-Type: text/plain; charset="utf-8" > >This patch enhances the tags review page in the staff client by adding >DataTables sorting to the table of tags. > >It also converts the tag list page (list.tt) to use the new DataTables >include introduced by Bug 10649. > >To test, apply the patch and view the tags review page for various >categories: Pending, approved, rejected, all. The table should be >sortable by status, term, weight, and date. Sorting by date should work >correctly regardless of date format preference. Title sorting on the tag >list page should work correctly. >--- > .../intranet-tmpl/prog/en/modules/tags/list.tt | 4 +- > .../intranet-tmpl/prog/en/modules/tags/review.tt | 108 ++++++++++++-------- > tags/review.pl | 3 - > 3 files changed, 67 insertions(+), 48 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt >index 3e49787..5749ceb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt >@@ -2,9 +2,7 @@ > <title>Koha › Tools › Tags › [% IF ( do_it ) %]Review › [% ELSE %]Review tags[% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/en/css/datatables.css" /> >-<script type="text/javascript" src="[% interface %]/[% theme %]/en/lib/jquery/plugins/jquery.dataTables.min.js"></script> >-[% INCLUDE 'datatables-strings.inc' %] >-<script type="text/javascript" src="[% interface %]/[% theme %]/en/js/datatables.js"></script> >+[% INCLUDE 'datatables.inc' %] > <script type="text/javascript"> > //<![CDATA[ > $(document).ready(function() { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt >index 89c998a..a16891f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt >@@ -1,6 +1,9 @@ >+[% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Home › Tools › Tags › [% IF ( do_it ) %]Review › [% ELSE %]Review tags[% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] >+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/en/css/datatables.css" /> >+[% INCLUDE 'datatables.inc' %] > [% INCLUDE 'calendar.inc' %] > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> > <style type="text/css"> >@@ -121,6 +124,22 @@ td input,td input[type="submit"] { font-size: 85%; padding: 1px; } > $("*").ajaxError(function(evt, request, settings){ > if ((alerted +=1) <= 1){ window.alert(_("AJAX error")+" (" + alerted + " alert)"); } > }); >+ $("#tagst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ [% IF ( filter_approved_pending ) %] >+ { "aTargets": [ 0,1,-2 ], "bSortable": false, "bSearchable": false } >+ [% ELSE %] >+ { "aTargets": [ 0,1,-3 ], "bSortable": false, "bSearchable": false } >+ [% END %] >+ ], >+ "aoColumns": [ >+ null,null,null,null,null,null,[% UNLESS ( filter_approved_pending ) %]null,[% END %]{ "sType": "title-string" } >+ ], >+ "aaSorting": [[ 4, "desc" ]], >+ "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]], >+ "iDisplayLength": 20, >+ "sPaginationType": "four_button" >+ })); > }); > //]]> > </script> >@@ -184,58 +203,63 @@ td input,td input[type="submit"] { font-size: 85%; padding: 1px; } > [% END %] > [% IF ( tagloop ) %] > <p class="check"></p> >- <table> >- <tr> >- <th> </th> >- <th> </th> >+ <table id="tagst"> >+ <thead> >+ <tr> >+ <th> </th> >+ <th> </th> > <th>Status</th> > <th>Term</th> > <th>Weight</th> > <th>Actions</th> >- [% UNLESS ( filter_approved_pending ) %]<th>Reviewer</th>[% END %] >+ [% UNLESS ( filter_approved_pending ) %]<th>Reviewer</th>[% END %] > <th>Date</th> > </tr> >+ </thead> >+ <tbody> > [% FOREACH tagloo IN tagloop %] >- <tr> >- <td class="count">[% offset + loop.count %] >- </td> >- [% IF ( tagloo.approved == 0 ) %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" class="pending" /></span> >- [% ELSE %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" /></span>[% END %] >- </td> >- [% IF ( tagloo.approved == -1 ) %]<td class="red">rejected >- [% ELSIF ( tagloo.approved == 1 ) %]<td class="green"><img alt="OK" src="[% interface %]/[% theme %]/img/approve.gif" /> >- [% ELSE %]<td class="pending"> >- [% END %] >- </td> >- <td><a href="/cgi-bin/koha/tags/list.pl?tag=[% tagloo.term %]">[% tagloo.term %]</a> >- </td> >- <td>[% tagloo.weight_total %] >- </td> >- [% IF ( tagloo.approved ) %] >- <td><span class="ajax_buttons" style="visibility:hidden"> >- [% IF ( tagloo.approved == -1 ) %] >- <input class="ok" type="submit" title="[% tagloo.term %]" value="Approve" name="approve" /> >- <input class="rej" disabled="disabled" type="submit" title="[% tagloo.term %]" value="Rejected" name="reject" /> >+ <tr> >+ <td class="count">[% offset + loop.count %] >+ </td> >+ [% IF ( tagloo.approved == 0 ) %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" class="pending" /></span> >+ [% ELSE %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" /></span>[% END %] >+ </td> >+ [% IF ( tagloo.approved == -1 ) %]<td class="red">rejected >+ [% ELSIF ( tagloo.approved == 1 ) %]<td class="green"><img alt="OK" src="[% interface %]/[% theme %]/img/approve.gif" /> >+ [% ELSE %]<td class="pending"> >+ [% END %] >+ </td> >+ <td><a href="/cgi-bin/koha/tags/list.pl?tag=[% tagloo.term|uri %]">[% tagloo.term %]</a> >+ </td> >+ <td>[% tagloo.weight_total %] >+ </td> >+ [% IF ( tagloo.approved ) %] >+ <td><span class="ajax_buttons" style="visibility:hidden"> >+ [% IF ( tagloo.approved == -1 ) %] >+ <input class="ok" type="submit" title="[% tagloo.term %]" value="Approve" name="approve" /> >+ <input class="rej" disabled="disabled" type="submit" title="[% tagloo.term %]" value="Rejected" name="reject" /> >+ [% ELSE %] >+ <input class="ok" disabled="disabled" type="submit" title="[% tagloo.term %]" value="Approved" name="approve" /> >+ <input class="rej" type="submit" title="[% tagloo.term %]" value="Reject" name="reject" /> >+ [% END %] >+ </span> >+ </td> >+ <td>[% IF ( tagloo.approved_by_name ) %]<a href="/cgi-bin/koha/tags/review.pl?approved_by=[% tagloo.approved_by %]&approved=all">[% tagloo.approved_by_name %]</a>[% ELSE %] [% END %] >+ </td> > [% ELSE %] >- <input class="ok" disabled="disabled" type="submit" title="[% tagloo.term %]" value="Approved" name="approve" /> >- <input class="rej" type="submit" title="[% tagloo.term %]" value="Reject" name="reject" /> >+ <td><span class="ajax_buttons" style="visibility:hidden"> >+ <input class="ok" type="submit" title="[% tagloo.term %]" value="Approve" name="approve" /> >+ <input class="rej" type="submit" title="[% tagloo.term %]" value="Reject" name="reject" /> >+ </span> >+ </td> >+ [% UNLESS ( filter_approved_pending ) %]<td> </td>[% END %] > [% END %] >- </span> >- </td> >- <td>[% IF ( tagloo.approved_by_name ) %]<a href="/cgi-bin/koha/tags/review.pl?approved_by=[% tagloo.approved_by %]&approved=all">[% tagloo.approved_by_name %]</a>[% ELSE %] [% END %] >- </td> >- [% ELSE %] >- <td><span class="ajax_buttons" style="visibility:hidden"> >- <input class="ok" type="submit" title="[% tagloo.term %]" value="Approve" name="approve" /> >- <input class="rej" type="submit" title="[% tagloo.term %]" value="Reject" name="reject" /> >- </span> >- </td> >- [% UNLESS ( filter_approved_pending ) %]<td> </td>[% END %] >- [% END %] >- <td>[% tagloo.date_approved %] >- </td> >- </tr> >+ <td> >+ <span title="[% tagloo.date_approved %]">[% tagloo.date_approved | $KohaDates %]</span> >+ </td> >+ </tr> > [% END %] >+ </tbody> > </table> > [% END %] > [% IF ( tagloop ) %]<fieldset class="action"> >diff --git a/tags/review.pl b/tags/review.pl >index 1affd53..37d1412 100755 >--- a/tags/review.pl >+++ b/tags/review.pl >@@ -202,9 +202,6 @@ if ($filter = $input->param('approved_by')) { # borrowernumber from link > } > $debug and print STDERR "filters: " . Dumper(\%filters); > my $tagloop = get_approval_rows(\%filters); >-for ( @{$tagloop} ) { >- $_->{date_approved} = format_date( $_->{date_approved} ); >-} > my $qstring = $input->query_string; > $qstring =~ s/([&;])*\blimit=\d+//; # remove pagination var > $qstring =~ s/^;+//; # remove leading delims >-- >1.7.9.5
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 10730
:
20921
|
21411
|
21413
|
21414