Bug 30975: (QA follow-up) Fix for authorities and upload plugin
Authorities still needed a few tweaks for text2 (obscure name for plugins). Upload plugin does not have buttonDot 'mark'. Cloning was still an issue. Not the most elegant solution but it works. We should not have this exception for just another icon or so. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
05946c473b
commit
4837aa9a1c
3 changed files with 34 additions and 17 deletions
|
@ -729,8 +729,8 @@
|
|||
</select>
|
||||
[% ELSIF ( mv.type == 'text1' ) %]
|
||||
<input type="text" id="[%- mv.id | html -%]" name="[%- mv.id | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" />
|
||||
[% ELSIF ( mv.type == 'text2' ) %]
|
||||
<input type="text" id="[%- mv.id | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" />
|
||||
[% ELSIF ( mv.type == 'text2' ) # plugin %]
|
||||
<input type="text" id="[%- mv.id | html -%]" size="67" maxlength="[%- mv.maxlength | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" data-plugin="[% mv.plugin | html %]" class="input_marceditor framework_plugin" />
|
||||
[% ELSIF ( mv.type == 'text' ) %]
|
||||
<input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" size="67" maxlength="[%- mv.maxlength | html -%]" />
|
||||
[% ELSIF ( mv.type == 'textarea' ) %]
|
||||
|
@ -755,7 +755,7 @@
|
|||
[% IF mv.noclick %]
|
||||
<a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup">...</a>
|
||||
[% ELSE %]
|
||||
<a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor" title="Tag editor" data-plugin="[% mv.plugin | html %]">...</a>
|
||||
<a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor framework_plugin" title="Tag editor" data-plugin="[% mv.plugin | html %]">...</a>
|
||||
[% END %]
|
||||
[% mv.javascript | $raw %]
|
||||
[% END #/IF ( mv.type == 'text1' ) %]
|
||||
|
|
|
@ -481,9 +481,9 @@
|
|||
var res = '[% Koha.Preference('OPACBaseURL') | html %]';
|
||||
res = res.replace( /\/$/, '');
|
||||
res = res + '/cgi-bin/koha/opac-retrieve-file.pl?id=' + hashval;
|
||||
[% IF index %]
|
||||
$(window.opener.document).find('#[% index | html %]').val( res );
|
||||
[% END %]
|
||||
var index = '[% index | html %]';
|
||||
index = index.replace( /^buttonDot_/, '' );
|
||||
if(index) $(window.opener.document).find('#'+index).val( res );
|
||||
window.close();
|
||||
}
|
||||
var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'upload', 'uploadresults', 'json' ) | $raw %];
|
||||
|
|
|
@ -803,26 +803,35 @@ Koha.frameworkPlugins ||= {};
|
|||
function registerFrameworkPluginHandler(name, eventType, handler) {
|
||||
// 'focus' and 'blur' events do not bubble,
|
||||
// so we have to use 'focusin' and 'focusout' instead
|
||||
if (eventType === 'focus') eventType = 'focusin';
|
||||
else if (eventType === 'blur') eventType = 'focusout';
|
||||
if (eventType === "focus") eventType = "focusin";
|
||||
else if (eventType === "blur") eventType = "focusout";
|
||||
|
||||
Koha.frameworkPlugins[name] ||= {};
|
||||
Koha.frameworkPlugins[name][eventType] ||= handler;
|
||||
}
|
||||
$(document).ready(function() {
|
||||
function callClickPluginEventHandler (event) {
|
||||
$(document).ready(function () {
|
||||
function callClickPluginEventHandler(event) {
|
||||
event.preventDefault();
|
||||
callPluginEventHandler.call(this, event);
|
||||
}
|
||||
|
||||
function callPluginEventHandler (event) {
|
||||
function callPluginEventHandler(event) {
|
||||
event.stopPropagation();
|
||||
|
||||
const plugin = event.target.getAttribute('data-plugin');
|
||||
if (plugin && plugin in Koha.frameworkPlugins && event.type in Koha.frameworkPlugins[plugin]) {
|
||||
const plugin = event.target.getAttribute("data-plugin");
|
||||
if (
|
||||
plugin &&
|
||||
plugin in Koha.frameworkPlugins &&
|
||||
event.type in Koha.frameworkPlugins[plugin]
|
||||
) {
|
||||
event.data = {};
|
||||
if (event.target.classList.contains('buttonDot')) {
|
||||
event.data.id = event.target.closest('.subfield_line').querySelector('input.input_marceditor').id;
|
||||
if (
|
||||
event.target.classList.contains("framework_plugin") ||
|
||||
event.target.classList.contains("buttonDot")
|
||||
) {
|
||||
event.data.id = event.target
|
||||
.closest(".subfield_line")
|
||||
.querySelector("input.input_marceditor").id;
|
||||
} else {
|
||||
event.data.id = event.target.id;
|
||||
}
|
||||
|
@ -834,6 +843,14 @@ $(document).ready(function() {
|
|||
// We use delegated event handlers here so that dynamically added elements
|
||||
// (like when cloning a field or a subfield) respond to these events
|
||||
// without having to re-attach events manually
|
||||
$('.marc_editor').on('click', '.tag_editor.framework_plugin', callClickPluginEventHandler);
|
||||
$('.marc_editor').on('focusin focusout change mousedown mouseup keydown keyup', 'input.input_marceditor.framework_plugin', callPluginEventHandler);
|
||||
$(".marc_editor").on(
|
||||
"click",
|
||||
".tag_editor.framework_plugin",
|
||||
callClickPluginEventHandler
|
||||
);
|
||||
$(".marc_editor").on(
|
||||
"focusin focusout change mousedown mouseup keydown keyup",
|
||||
"input.input_marceditor.framework_plugin",
|
||||
callPluginEventHandler
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue