Koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes.tt
Katrin Fischer 2413ab7e79
Bug 33076: Add context to "Quotes"
A quote as a part of quoted text and a quote as
part of the acquisition process need to be
translated differently at least in German.
This patch adds context to the terms, so we can
do that.

To test:
* Go to Tools > Quote editor
* Verify the heading of the page reads "Quotes"
* Enable EDIFACT system preference
* Go to Administration > EDI accounts
* Add a new account save
* Verify the table heading reads "Quotes"
* Apply patch - nothing should change

Verify the translation process:
* Run: gulp po:update --lang de-DE
* Verify the "Quotes" appear now separated by
  different context in
  misc/translator/po/de-DE-messages.po

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-16 16:24:03 -03:00

251 lines
10 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[% USE raw %]
[% USE Asset %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Quote editor &rsaquo; Tools &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("css/quotes.css") | $raw %]
</head>
<body id="tools_quotes" class="tools">
[% WRAPPER 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
[% END %]
[% WRAPPER 'sub-header.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>
[% END %]
<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' %]
<span>An error occurred when updating this quote. Perhaps it already exists</span>
[% CASE 'error_on_insert' %]
<span>An error occurred when adding this quote</span>
[% CASE 'success_on_update' %]
<span>Quote updated successfully</span>
[% CASE 'success_on_insert' %]
<span>Quote added successfully</span>
[% CASE %]
<span>[% m.code | html %]</span>
[% 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' %]
<h1>[% IF quote %]Modify quote[% ELSE %]New quote[% END %]</h1>
<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" class="btn btn-primary" 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">
<h1>Are you sure you want to delete the following quote?</h1>
[% 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' %]
<h1>[% tp('citations', 'Quotes') | html %]</h1>
[% IF quotes_count > 0 %]
<div class="page-section">
<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>
</div> <!-- /.page-section -->
[% 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 'datatables.inc' %]
<script>
$(document).ready(function() {
var quotes_url = '/api/v1/quotes';
var quotes = $("#quotes").kohaTable({
"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&amp;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' %]