Bug 21695: Clean up access files template
authorOwen Leonard <oleonard@myacpl.org>
Fri, 26 Oct 2018 18:36:59 +0000 (18:36 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Wed, 26 Dec 2018 20:47:04 +0000 (20:47 +0000)
This patch modifies the access files template to help
compliance with several coding guidelines:

- Bootstrap grid
- Improve DataTables configuration
- Move date formatting from the script to the template
- Markup corrections

To test you must modify koha-conf.xml to contain something like the
following:

<access_dirs>
    <access_dir>/tmp/koha-public</access_dir>
</access_dirs>

Make sure the directory exists and contains multiple files.

 - Go to Tools -> Access files
 - Confirm that the page looks correct and the layout adjusts at various
   browser widths.
 - Confirm that DataTables functionality works correctly, including
   correct sorting by date.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

koha-tmpl/intranet-tmpl/prog/en/modules/tools/access_files.tt
tools/access_files.pl

index 214ba23..19a0743 100644 (file)
@@ -1,5 +1,6 @@
 [% USE raw %]
 [% USE Asset %]
+[% USE KohaDates %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Access files</title>
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Access files</div>
 
-<div id="doc3" class="yui-t2">
-   <div id="bd">
-    <div id="yui-main">
-    <div class="yui-b">
+<div class="main container-fluid">
+    <div class="row">
+        <div class="col-sm-10 col-sm-push-2">
+            <main>
 
     <h1>Access files</h1>
 
@@ -28,7 +29,7 @@
                 <tr>
                     <th>Name</th>
                     <th>Size (bytes)</th>
-                    <th>Date last modified</th>
+                    <th class="title-string">Date last modified</th>
                 </tr>
             </thead>
             <tbody>
                 <tr>
                     <td><a href="/cgi-bin/koha/tools/access_files.pl?id=[% file.id |url %]">[% file.name | html %]</a></td>
                     <td align="right">[% file.size | html %]</td>
-                    <td>[% file.date | html %]</td>
+                    <td><span title="[% file.date | html %]">[% file.date | $KohaDates %]</span></td>
                 </tr>
                 [% END %]
             </tbody>
         </table>
     [% ELSE %]
-        No file found.
+        <div class="dialog message">No files found.</div>
     [% END %]
 [% END %]
 
-</div>
-</div>
-<div class="yui-b">
-[% INCLUDE 'tools-menu.inc' %]
-</div>
-</div>
+            </main>
+        </div> <!-- /.col-sm-10.col-sm-push-2 -->
+
+        <div class="col-sm-2 col-sm-pull-10">
+            <aside>
+                [% INCLUDE 'tools-menu.inc' %]
+            </aside>
+        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
+    </div> <!-- /.row -->
+
 
 [% MACRO jsinclude BLOCK %]
     [% Asset.js("js/tools-menu.js") | $raw %]
     [% INCLUDE 'datatables.inc' %]
-    <script type="text/javascript">
-    //<![CDATA[
+    <script>
         $(document).ready(function() {
             $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
-                "sDom": 't',
                 "aoColumnDefs": [
-                    { "aTargets": [ -1 ], "asSorting" : [ "desc", "asc" ], "bSearchable": false }
+                    { "aTargets": [ -1 ], "asSorting" : [ "desc", "asc" ], "bSearchable": false },
+                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
                 ],
                 "bPaginate": false
             }));
     });
-    //]]>
 </script>
 [% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 4175017..668ede8 100755 (executable)
@@ -82,7 +82,7 @@ else {
                             );
             push(@files_list, {name => $decoded_filename,
                                access_dir => $dir,
-                               date =>Koha::DateUtils::output_pref($dt),
+                               date =>$dt,
                                size => $st->size,
                                id   => $id});
         }