Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt
Owen Leonard 6c7c97f67c Bug 22015: Move DataTables CSS to global include
DataTables are used on enough pages in the staff client that it
doesn't make sense to put inclusion of the CSS into each template
where it is needed. This patch moves includes of datatables.css from
individual templates into the global header file.

To test, apply the patch and view various pages which have DataTables.
View various styles of DataTables, e.g.

 - Full pagination, like item search results
 - Four-button, like Saved SQL reports

Everything should look the same as it was.

Signed-off-by: Jose-Mario Monteiro-Santos <jose-mario.monteiro-santos@inLibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-02-19 19:40:35 +00:00

197 lines
7.6 KiB
Text

[% USE raw %]
[% USE Asset %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; [% IF op =='add_form' %]Cities &rsaquo; [% IF city.cityid %] Modify city[% ELSE %] New city[% END %][% ELSE %][% IF op == 'delete_confirm' %]Cities &rsaquo; Confirm deletion of city[% ELSE %] Cities[% END %][% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="admin_cities" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cities-admin-search.inc' %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
&rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
&rsaquo; <a href="/cgi-bin/koha/admin/cities.pl">Cities</a>
[% IF op == 'add_form' %]
&rsaquo; [% IF city.cityid %]Modify[% ELSE %]New[% END %] City
[% ELSIF op == 'delete_confirm' %]
&rsaquo; Confirm deletion of city
[% END %]
</div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% FOR m IN messages %]
<div class="dialog [% m.type | html %]">
[% SWITCH m.code %]
[% CASE 'error_on_update' %]
An error occurred when updating this city. Perhaps it already exists.
[% CASE 'error_on_insert' %]
An error occurred when adding this city. The city id might already exist.
[% CASE 'error_on_delete' %]
An error occurred when deleting this city. Check the logs.
[% CASE 'success_on_update' %]
City updated successfully.
[% CASE 'success_on_insert' %]
City added successfully.
[% CASE 'success_on_delete' %]
City deleted successfully.
[% CASE 'already_exists' %]
This city already exists.
[% CASE %]
[% m.code | html %]
[% END %]
</div>
[% END %]
[% IF op == 'add_form' %]
[% IF city %]
<h1>Modify a city</h1>
[% ELSE %]
<h1>New city</h1>
[% END %]
<form action="/cgi-bin/koha/admin/cities.pl" name="Aform" method="post" class="validated">
<input type="hidden" name="op" value="add_validate" />
<input type="hidden" name="cityid" value="[% city.cityid | html %]" />
<fieldset class="rows">
<ol>
[% IF city %]
<li><span class="label">City ID: </span>[% city.cityid | html %]</li>
[% END %]
<li>
<label for="city_name" class="required">City: </label>
<input type="text" name="city_name" id="city_name" size="80" maxlength="100" value="[% city.city_name | html %]" required="required" class="required" /> <span class="required">Required</span>
</li>
<li>
<label for="city_state">State: </label>
<input type="text" name="city_state" id="city_state" size="80" maxlength="100" value="[% city.city_state | html %]" />
</li>
<li>
<label for="city_zipcode" class="required">ZIP/Postal code: </label>
<input type="text" name="city_zipcode" id="city_zipcode" size="20" maxlength="20" value="[% city.city_zipcode | html %]" required="required" class="required" /> <span class="required">Required</span>
</li>
<li>
<label for="city_country">Country: </label>
<input type="text" name="city_country" id="city_country" size="80" maxlength="100" value="[% city.city_country | html %]" />
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Submit" />
<a class="cancel" href="/cgi-bin/koha/admin/cities.pl">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF op == 'delete_confirm' %]
<div class="dialog alert">
<h3>Delete city "[% city.city_name | html %]?"</h3>
<table>
<tr><th>City id</th>
<td>[% city.cityid | html %]</td>
</tr>
<tr><th>City</th>
<td>[% city.city_name | html %]</td>
</tr>
<tr><th>State</th>
<td>[% city.city_state | html %]</td>
</tr>
<tr><th>ZIP/Postal code</th>
<td>[% city.city_zipcode | html %]</td>
</tr>
<tr><th>Country</th>
<td>[% city.city_country | html %]</td>
</tr>
</table>
<form action="/cgi-bin/koha/admin/cities.pl" method="post">
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="cityid" value="[% city.cityid | html %]" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
</form>
<form action="/cgi-bin/koha/admin/cities.pl" method="get">
<button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
</form>
</div>
[% END %]
[% IF op == 'list' %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default btn-sm" id="newcity" href="/cgi-bin/koha/admin/cities.pl?op=add_form"><i class="fa fa-plus"></i> New city</a>
</div>
<h2>Cities</h2>
[% IF searchfield %]
Searching: [% searchfield | html %]
[% END %]
[% IF cities.count %]
<table id="table_cities">
<thead>
<tr>
<th>City ID</th>
<th>City</th>
<th>State</th>
<th>ZIP/Postal code</th>
<th>Country</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
[% FOREACH city IN cities %]
<tr>
<td>[% city.cityid | html %]</td>
<td>[% city.city_name | html %]</td>
<td>[% city.city_state | html %]</td>
<td>[% city.city_zipcode | html %]</td>
<td>[% city.city_country | html %]</td>
<td class="actions">
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/cities.pl?op=add_form&amp;cityid=[% city.cityid | html %]"><i class="fa fa-pencil"></i> Edit</a>
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/cities.pl?op=delete_confirm&amp;cityid=[% city.cityid | html %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<div class="dialog message">
There are no cities defined. <a href="/cgi-bin/koha/admin/cities.pl?op=add_form">Create a new city</a>.
</div>
[% END %]
[% END %]
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'admin-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function() {
$("#table_cities").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
],
"aaSorting": [[ 1, "asc" ]],
"iDisplayLength": 10,
"sPaginationType": "full_numbers"
}));
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]