Wainui Witika-Park
b6f036a7ac
Swapped the order of the page titles to have the unique information first, i.e. the name of the specific page displays first, and the name of the website (e.g. Koha) displays at the end. To test: 1) Apply patch 2) Ensure each of the files in the tools folder are swapped around to display the most unique information first, and the website name is at the end 3) Ensure the pages displayed on the Staff Client that correspond to these files also display the changes Sponsored-by: Catalyst IT Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
246 lines
10 KiB
Text
246 lines
10 KiB
Text
[% USE raw %]
|
||
[% USE Asset %]
|
||
[% SET footerjs = 1 %]
|
||
[% INCLUDE 'doc-head-open.inc' %]
|
||
<title>Quote editor › Tools › Koha</title>
|
||
[% INCLUDE 'doc-head-close.inc' %]
|
||
[% Asset.css("css/quotes.css") | $raw %]
|
||
</head>
|
||
|
||
<body id="tools_quotes" class="tools">
|
||
[% INCLUDE 'header.inc' %]
|
||
[% INCLUDE 'cat-search.inc' %]
|
||
|
||
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
|
||
<ol>
|
||
<li>
|
||
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
|
||
</li>
|
||
<li>
|
||
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
|
||
</li>
|
||
<li>
|
||
<a href="#" aria-current="page">
|
||
Quote editor
|
||
</a>
|
||
</li>
|
||
</ol>
|
||
</nav>
|
||
|
||
<div class="main container-fluid">
|
||
<div class="row">
|
||
<div class="col-sm-10 col-sm-push-2">
|
||
<main>
|
||
|
||
[% FOREACH m IN messages %]
|
||
<div class="dialog [% m.type | html %]" id="quote_action_result_dialog">
|
||
[% SWITCH m.code %]
|
||
[% CASE 'error_on_update' %]
|
||
An error occurred when updating this quote. Perhaps it already exists.
|
||
[% CASE 'error_on_insert' %]
|
||
An error occurred when adding this quote.
|
||
[% CASE 'success_on_update' %]
|
||
Quote updated successfully.
|
||
[% CASE 'success_on_insert' %]
|
||
Quote added successfully.
|
||
[% CASE %]
|
||
[% m.code | html %]
|
||
[% END %]
|
||
</div>
|
||
[% END %]
|
||
|
||
<div class="dialog message" id="quote_delete_success" style="display: none;"></div>
|
||
<div class="dialog alert" id="quote_delete_error" style="display: none;"></div>
|
||
|
||
[% IF op == 'list' %]
|
||
<div id="toolbar" class="btn-toolbar">
|
||
<a class="btn btn-default" id="newquote" href="/cgi-bin/koha/tools/quotes.pl?op=add_form"><i class="fa fa-plus"></i> New quote</a>
|
||
<a class="btn btn-default" id="import_quotes" href="/cgi-bin/koha/tools/quotes-upload.pl"><i class="fa fa-folder-open"></i> Import quotes</a>
|
||
</div>
|
||
[% END %]
|
||
|
||
[% IF op == 'add_form' %]
|
||
<h3>[% IF quote %]Modify quote[% ELSE %]New quote[% END %]</h3>
|
||
<form action="/cgi-bin/koha/tools/quotes.pl" id="Aform" name="Aform" class="validated" method="post">
|
||
<fieldset class="rows">
|
||
<input type="hidden" name="op" value="add_validate" />
|
||
<ol>
|
||
<li>
|
||
<label for="text" class="required">Source: </label>
|
||
<input type="text" name="source" id="source" value="[% quote.source | html %]" class="required" required="required" />
|
||
<span class="required">Required</span>
|
||
</li>
|
||
<li>
|
||
<label for="text" class="required">Text: </label>
|
||
<textarea name="text" id="text" class="required" required="required" />[% quote.text | html %]</textarea>
|
||
<span class="required">Required</span>
|
||
</li>
|
||
</ol>
|
||
</fieldset>
|
||
<fieldset class="action">
|
||
<input type="hidden" name="id" value="[% quote.id | html %]" />
|
||
<input type="submit" value="Submit" />
|
||
<a class="cancel" href="/cgi-bin/koha/tools/quotes.pl">Cancel</a>
|
||
</fieldset>
|
||
</form>
|
||
[% END %]
|
||
|
||
[% IF op == 'delete_confirm' %]
|
||
<div class="dialog alert">
|
||
<form action="/cgi-bin/koha/tools/quotes.pl" method="post">
|
||
<h3>Are you sure you want to delete the following quote?</h3>
|
||
[% quote.source | html %] - [% quote.text | html %]
|
||
<input type="hidden" name="op" value="delete_confirmed" />
|
||
<input type="hidden" name="id" value="[% quote.id | html %]" />
|
||
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
|
||
</form>
|
||
<form action="/cgi-bin/koha/tools/quotes.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' %]
|
||
<h3>Quotes</h3>
|
||
[% IF quotes_count > 0 %]
|
||
<table id="quotes">
|
||
<thead>
|
||
<tr>
|
||
<th>ID</th>
|
||
<th>Source</th>
|
||
<th>Text</th>
|
||
<th>Last display</th>
|
||
<th data-class-name="actions" class="noExport">Actions</th>
|
||
</tr>
|
||
</thead>
|
||
</table>
|
||
[% ELSE %]
|
||
<div class="dialog message">There are no quotes defined. <a href="/cgi-bin/koha/tools/quotes.pl?op=add_form">Start defining quotes</a>.</div>
|
||
[% END %]
|
||
|
||
<div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
|
||
<h3 id="delete_confirm_modal_label">Delete quote</h3>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div id="delete_confirm_dialog"></div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a>
|
||
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
|
||
</div>
|
||
</div> <!-- /.modal-content -->
|
||
</div> <!-- /.modal-dialog -->
|
||
</div> <!-- #delete_confirm_modal -->
|
||
[% END %]
|
||
|
||
</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 'js-date-format.inc' %]
|
||
[% INCLUDE 'datatables.inc' %]
|
||
|
||
<script>
|
||
$(document).ready(function() {
|
||
|
||
var quotes_url = '/api/v1/quotes';
|
||
var quotes = $("#quotes").api({
|
||
"ajax": {
|
||
"url": quotes_url
|
||
},
|
||
'emptyTable': '<div class="dialog message">'+_("There are no quotes defined.")+' <a href="/cgi-bin/koha/tools/quotes.pl?op=add_form">'+_("Start defining quotes")+'</a>.</div>',
|
||
"columnDefs": [ {
|
||
"targets": [0,1,2,3],
|
||
"render": function (data, type, row, meta) {
|
||
if ( type == 'display' ) {
|
||
if ( data != null ) {
|
||
return data.escapeHtml();
|
||
}
|
||
else {
|
||
return "";
|
||
}
|
||
}
|
||
return data;
|
||
}
|
||
} ],
|
||
"columns": [
|
||
{
|
||
"data": "quote_id",
|
||
"searchable": true,
|
||
"orderable": true
|
||
},
|
||
{
|
||
"data": "source",
|
||
"searchable": true,
|
||
"orderable": true
|
||
},
|
||
{
|
||
"data": "text",
|
||
"searchable": true,
|
||
"orderable": true
|
||
},
|
||
{
|
||
"data": "displayed_on",
|
||
"render": function(data, type, row, meta) {
|
||
return $datetime(row.displayed_on);
|
||
},
|
||
"searchable": true,
|
||
"orderable": true
|
||
},
|
||
{
|
||
"data": function( row, type, val, meta ) {
|
||
|
||
var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/quotes.pl?op=add_form&id='+encodeURIComponent(row.quote_id)+'" role="button"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>';
|
||
result += '<form action="/cgi-bin/koha/tools/quotes.pl" method="post">';
|
||
result += '<input type="hidden" name="id" value="'+row.quote_id.escapeHtml()+'" />'+"\n";
|
||
|
||
result += '<a class="btn btn-default btn-xs delete_quote" role="button" href="#" data-toggle="modal" data-target="#delete_confirm_modal" data-quote-id="'+ encodeURIComponent(row.quote_id) +'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Delete")+'</a>';
|
||
|
||
return result;
|
||
},
|
||
"searchable": false,
|
||
"orderable": false
|
||
},
|
||
]
|
||
});
|
||
|
||
$('#quotes').on( "click", '.delete_quote', function () {
|
||
var quote_id = decodeURIComponent($(this).data('quote-id'));
|
||
|
||
$("#delete_confirm_dialog").html(
|
||
_("You are about to delete the quote #%s.").format(quote_id)
|
||
);
|
||
|
||
$("#delete_confirm_modal_button").unbind("click").on( "click", function () {
|
||
$.ajax({
|
||
method: "DELETE",
|
||
url: "/api/v1/quotes/"+quote_id
|
||
}).success(function() {
|
||
$("#delete_confirm_modal").modal('hide');
|
||
quotes.api().ajax.reload(function (data) {
|
||
$("#quote_action_result_dialog").hide();
|
||
$("#quote_delete_success").html(_("Quote #%s deleted successfully.").format(quote_id)).show();
|
||
});
|
||
}).error(function () {
|
||
$("#quote_delete_error").html(_("Error deleting quote #%s. Check the logs.").format(quote_id)).show();
|
||
});
|
||
});
|
||
});
|
||
|
||
});
|
||
</script>
|
||
[% END %]
|
||
|
||
[% INCLUDE 'intranet-bottom.inc' %]
|