Owen Leonard
ff08d49680
Many pages can have alerts that get their style from a variable passed by the script, e.g.: push @messages, { type => 'message', code => 'success_on_update' }; Rather than change these to match Bootstrap 5 styles, I propose we add a copy of the existing Bootstrap style using the existing vocabulary: message -> info alert -> warning error -> danger To test, apply the patch and rebuild CSS for the staff interface and OPAC: (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_interface) - Clear your browser cache if necessary. - Navigate to pages which have been updated by this patch. Many pages will implement this kind of alert after saving an edit, especially administration pages, e.g. Administration -> Libraries -> Edit library -> Save. - You can test the various alert classes by adding this HTML to IntranetMainUserBlock and OpacMainUserBlock and viewing the staff interface and OPAC main pages.: <div class="alert alert-danger">A standard Bootstrap danger alert with <a href="#" class="alert-link">an example link</a>.</div> <div class="alert alert-warning">A standard Bootstrap warning alert with <a href="#" class="alert-link">an example link</a>.</div> <div class="alert alert-info">A standard Bootstrap info alert with <a href="#" class="alert-link">an example link</a>.</div> <div class="alert alert-error">A Koha error alert with <a href="#" class="alert-link">an example link</a>.</div> <div class="alert alert-alert">A Koha alert alert with <a href="#" class="alert-link">an example link</a>.</div> <div class="alert alert-message">A Koha info alert with <a href="#" class="alert-link">an example link</a>.</div> Sponsored-by: Athens County Public Libraries Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
298 lines
11 KiB
Text
298 lines
11 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE TablesSettings %]
|
|
[% PROCESS 'i18n.inc' %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>[% FILTER collapse %]
|
|
[% IF op =='add_form' %]
|
|
[% IF city.cityid %]
|
|
[% tx("Modify city '{city}'", { city = city.city_name }) | html %]
|
|
[% ELSE %]
|
|
[% t("New city") | html %]
|
|
[% END %] ›
|
|
[% ELSE %]
|
|
[% IF op == 'delete_confirm' %]
|
|
[% tx("Confirm deletion of city '{city}'", { city = city.city_name }) | html %] ›
|
|
[% END %]
|
|
[% END %]
|
|
[% t("Cities") | html %] ›
|
|
[% t("Administration") | html %] ›
|
|
[% t("Koha") | html %]
|
|
[% END %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="admin_cities" class="admin">
|
|
[% WRAPPER 'header.inc' %]
|
|
[% INCLUDE 'cities-admin-search.inc' %]
|
|
[% END %]
|
|
|
|
[% WRAPPER 'sub-header.inc' %]
|
|
[% WRAPPER breadcrumbs %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
|
|
[% END %]
|
|
|
|
[% IF op == 'add_form' %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/admin/cities.pl">Cities</a>
|
|
[% END %]
|
|
[% WRAPPER breadcrumb_item bc_active = 1 %]
|
|
[% IF city.cityid %]
|
|
[% tx("Modify city '{city}'", { city = city.city_name }) | html %]
|
|
[% ELSE %]
|
|
<span>New city</span>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% ELSIF op == 'delete_confirm' %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/admin/cities.pl">Cities</a>
|
|
[% END %]
|
|
[% WRAPPER breadcrumb_item bc_active = 1 %]
|
|
[% tx("Confirm deletion of city '{city}'", { city = city.city_name }) | html %]
|
|
[% END %]
|
|
|
|
[% ELSE %]
|
|
[% WRAPPER breadcrumb_item bc_active = 1 %]
|
|
<span>Cities</span>
|
|
[% END %]
|
|
[% END #/IF op = add_form %]
|
|
|
|
[% END #/ WRAPPER breadcrumbs %]
|
|
[% END #/ WRAPPER sub-header.inc %]
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-10 order-md-2 order-sm-1">
|
|
<main>
|
|
[% INCLUDE 'messages.inc' %]
|
|
|
|
[% FOR m IN messages %]
|
|
<div class="alert alert-[% m.type | html %]">
|
|
[% SWITCH m.code %]
|
|
[% CASE 'error_on_update' %]
|
|
<span>An error occurred when updating this city. Perhaps it already exists.</span>
|
|
[% CASE 'error_on_insert' %]
|
|
<span>An error occurred when adding this city. The city ID might already exist.</span>
|
|
[% CASE 'error_on_delete' %]
|
|
<span>An error occurred when deleting this city. Check the logs for details.</span>
|
|
[% CASE 'success_on_update' %]
|
|
<span>City updated successfully.</span>
|
|
[% CASE 'success_on_insert' %]
|
|
<span>City added successfully.</span>
|
|
[% CASE 'success_on_delete' %]
|
|
<span>City deleted successfully.</span>
|
|
[% CASE 'already_exists' %]
|
|
<span>This city already exists.</span>
|
|
[% CASE %]
|
|
<span>[% m.code | html %]</span>
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF op == 'add_form' %]
|
|
[% IF city %]
|
|
<h1>
|
|
[% tx("Modify city '{city}'", { city = city.city_name }) | html %]
|
|
</h1>
|
|
[% ELSE %]
|
|
<h1>New city</h1>
|
|
[% END %]
|
|
|
|
<form action="/cgi-bin/koha/admin/cities.pl" name="Aform" method="post" class="validated">
|
|
[% INCLUDE 'csrf-token.inc' %]
|
|
<input type="hidden" name="op" value="cud-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 focus" /> <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" class="btn btn-primary" value="Submit" />
|
|
<a class="cancel" href="/cgi-bin/koha/admin/cities.pl">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
[% IF op == 'delete_confirm' %]
|
|
<div class="alert alert-warning">
|
|
<h1>
|
|
[% tx("Confirm deletion of city '{city}'", { city = city.city_name }) | html %]
|
|
</h1>
|
|
<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">
|
|
[% INCLUDE 'csrf-token.inc' %]
|
|
<input type="hidden" name="op" value="cud-delete_confirmed" />
|
|
<input type="hidden" name="cityid" value="[% city.cityid | html %]" />
|
|
<button type="submit" class="btn btn-default 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="btn btn-default deny"><i class="fa fa-fw fa-times"></i> No, do not delete</button>
|
|
</form>
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF op == 'list' %]
|
|
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<a class="btn btn-default" id="newcity" href="/cgi-bin/koha/admin/cities.pl?op=add_form"><i class="fa fa-plus"></i> New city</a>
|
|
</div>
|
|
|
|
<h1>Cities</h1>
|
|
[% IF city_name_filter %]
|
|
<span>Searching: [% city_name_filter | html %]</span>
|
|
[% END %]
|
|
|
|
[% IF cities_count > 0 %]
|
|
<div class="page-section">
|
|
<div class="table_cities_table_controls"></div>
|
|
<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 data-class-name="actions noExport">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div><!-- /.page-section -->
|
|
[% ELSE %]
|
|
<div class="alert alert-info">
|
|
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-md-10.order-md-2 -->
|
|
|
|
<div class="col-md-2 order-sm-2 order-md-1">
|
|
<aside>
|
|
[% INCLUDE 'admin-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-md-2.order-md-1 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/admin-menu.js") | $raw %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
[% INCLUDE 'columns_settings.inc' %]
|
|
<script>
|
|
|
|
var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'cities', 'table_cities', 'json' ) | $raw %];
|
|
$(document).ready(function() {
|
|
var cities_table_url = '/api/v1/cities?';
|
|
|
|
[% IF city_name_filter %]
|
|
var city_name_filter = {
|
|
'name': {
|
|
"like": '%[%- city_name_filter | html -%]%'
|
|
}
|
|
};
|
|
cities_table_url += 'q='+ encodeURIComponent(JSON.stringify(city_name_filter));
|
|
[% END %]
|
|
|
|
var cities_table = $("#table_cities").kohaTable({
|
|
"ajax": {
|
|
"url": cities_table_url
|
|
},
|
|
"order": [[ 1, "asc" ]],
|
|
"columnDefs": [ {
|
|
"targets": [0,1,2,3,4],
|
|
"render": function (data, type, row, meta) {
|
|
if ( type == 'display' ) {
|
|
if ( data != null ) {
|
|
return data.escapeHtml();
|
|
} else {
|
|
return "";
|
|
}
|
|
}
|
|
return data;
|
|
}
|
|
} ],
|
|
"columns": [
|
|
{
|
|
"data": "city_id",
|
|
"searchable": true,
|
|
"orderable": true
|
|
},
|
|
{
|
|
"data": "name",
|
|
"searchable": true,
|
|
"orderable": true
|
|
},
|
|
{
|
|
"data": "state",
|
|
"searchable": true,
|
|
"orderable": true
|
|
},
|
|
{
|
|
"data": "postal_code",
|
|
"searchable": true,
|
|
"orderable": true
|
|
},
|
|
{
|
|
"data": "country",
|
|
"searchable": true,
|
|
"orderable": true
|
|
},
|
|
{
|
|
"data": function( row, type, val, meta ) {
|
|
|
|
var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/cities.pl?op=add_form&cityid='+ encodeURIComponent(row.city_id) +'"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n";
|
|
result += '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/cities.pl?op=delete_confirm&cityid='+ encodeURIComponent(row.city_id) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>';
|
|
return result;
|
|
|
|
},
|
|
"searchable": false,
|
|
"orderable": false
|
|
}
|
|
]
|
|
}, table_settings, 1);
|
|
|
|
});
|
|
</script>
|
|
[% END %]
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|