Bug 42290: Tidy all script tags - suggestion
In order to tidy all the script tags of the .tt files we isolate the interpolation of Template::Toolkit variables in a separate script tag. This patch focuses on the suggestion module. Trivial changes, the main changes have been done already, we only move them to a separate script tag. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
36e00f5aff
commit
e4293f93d2
|
|
@ -1207,6 +1207,19 @@
|
|||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'calendar.inc' %]
|
||||
[% INCLUDE 'select_manager.inc' manager => suggestion.manager %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]" data-tt-allowed="true">
|
||||
[% IF op == 'else' %]
|
||||
const has_suggestions = [% suggestions.size ? 1 : 0 | html %];
|
||||
let suggestionData = [% To.json(suggestions || []) | $raw %];
|
||||
var suggestions_table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'suggestions', 'suggestions', 'json' ) | $raw %]
|
||||
Koha.addPermissions({
|
||||
CAN_user_suggestions_suggestions_manage: [% CAN_user_suggestions_suggestions_manage ? 1 : 0 | html %],
|
||||
CAN_user_suggestions_suggestions_delete: [% CAN_user_suggestions_suggestions_delete ? 1 : 0 | html %],
|
||||
});
|
||||
[% ELSIF op == 'save' %]
|
||||
const has_other_reason = [% other_reason ? 1 : 0 | html %];
|
||||
[% END %]
|
||||
</script>
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
function select_suggester(borrowernumber, borrower) {
|
||||
$.ajax({
|
||||
|
|
@ -1253,15 +1266,6 @@
|
|||
</script>
|
||||
[% END %]
|
||||
[% IF op == 'else' %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
const has_suggestions = [% suggestions.size ? 1 : 0 | html %];
|
||||
let suggestionData = [% To.json(suggestions || []) | $raw %];
|
||||
var suggestions_table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'suggestions', 'suggestions', 'json' ) | $raw %]
|
||||
Koha.addPermissions({
|
||||
CAN_user_suggestions_suggestions_manage: [% CAN_user_suggestions_suggestions_manage ? 1 : 0 | html %],
|
||||
CAN_user_suggestions_suggestions_delete: [% CAN_user_suggestions_suggestions_delete ? 1 : 0 | html %],
|
||||
});
|
||||
</script>
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
$(document).ready(function () {
|
||||
|
|
@ -1595,13 +1599,13 @@
|
|||
calcNewsuggTotal();
|
||||
});
|
||||
|
||||
[% IF other_reason %]
|
||||
if (has_other_reason){
|
||||
$(".select-reason").hide();
|
||||
$(".select-reason").find("option[value='other']").attr("selected","selected");
|
||||
$("#other_reason").show();
|
||||
[% ELSE %]
|
||||
} else {
|
||||
$("#other_reason").hide();
|
||||
[% END %]
|
||||
}
|
||||
$(".select-reason").change(function(){
|
||||
if($(this).val() == "other"){
|
||||
$(this).hide();
|
||||
|
|
|
|||
Loading…
Reference in New Issue