Bug 11736 - Use new DataTables include in Koha news templates
Bug 10649 introduced a new include file for adding DataTables-related JavaScript assets. This patch adds use of this include file to the Koha news page. To test you should have existing news items with varying creation and expiration dates. Apply the patch and confirm that table sorting works correctly for all settings of the dateformat system preference. C4::NewsChannels.pm has been modified so that it now passes an unformatted date to the template, where the KohaDates plugin is used to apply the correct formatting. Sorting is based on the unformatted date. Also corrected: Capitalization errors. Signed-off-by: wajasu <matted-34813@mypacks.net> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Works as described, no problems found. Also passes tests and QA script. Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
3fc7ea191c
commit
a4a014e365
2 changed files with 9 additions and 10 deletions
|
@ -116,8 +116,6 @@ sub get_opac_news {
|
|||
my $count = 0;
|
||||
while (my $row = $sth->fetchrow_hashref) {
|
||||
if ((($limit) && ($count < $limit)) || (!$limit)) {
|
||||
$row->{'newdate'} = format_date($row->{'newdate'});
|
||||
$row->{'expirationdate'} = format_date($row->{'expirationdate'});
|
||||
push @opac_news, $row;
|
||||
}
|
||||
$count++;
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
[% USE KohaDates %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title>Koha › Tools › News</title>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
[% INCLUDE 'calendar.inc' %]
|
||||
[% IF ( opac_news_count ) %]
|
||||
<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>
|
||||
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
[% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %]
|
||||
$(document).ready(function() {
|
||||
$("#newst").dataTable($.extend(true, {}, dataTablesDefaults, {
|
||||
"sDom": 't',
|
||||
"aoColumnDefs": [
|
||||
{ "aTargets": [ 0,-1,-2 ], "bSortable": false, "bSearchable": false }
|
||||
],
|
||||
"aoColumns": [
|
||||
null,null,null,{ "sType": "title-string" },{ "sType": "title-string" },null,null,null
|
||||
],
|
||||
"bPaginate": false
|
||||
}));
|
||||
});
|
||||
|
@ -52,7 +53,7 @@ tinyMCE.init({
|
|||
[% INCLUDE 'cat-search.inc' %]
|
||||
|
||||
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% IF ( add_form ) %]<a href="/cgi-bin/koha/tools/koha-news.pl">News</a> › [% IF ( id ) %]
|
||||
Edit News Item[% ELSE %]Add News Item[% END %][% ELSE %]News[% END %]</div>
|
||||
Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
|
||||
|
||||
[% IF ( add_form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
|
||||
<div id="bd">
|
||||
|
@ -165,8 +166,8 @@ Edit News Item[% ELSE %]Add News Item[% END %][% ELSE %]News[% END %]</div>
|
|||
</td>
|
||||
|
||||
<td>[% opac_new.number %]</td>
|
||||
<td>[% opac_new.newdate %]</td>
|
||||
<td>[% opac_new.expirationdate %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</td>
|
||||
<td><span title="[% opac_new.newdate %]">[% opac_new.newdate | $KohaDates %]</span></td>
|
||||
<td><span title="[% opac_new.expirationdate %]">[% opac_new.expirationdate | $KohaDates %] [% IF ( opac_new.expired ) %](<span class="expired">expired</span>)[% END %]</span></td>
|
||||
<td>[% opac_new.title %]</td>
|
||||
<td>
|
||||
[% opac_new.new %]
|
||||
|
|
Loading…
Reference in a new issue