Bugzilla – Attachment 108926 Details for
Bug 25728
Add the ability to create a new authorised value within the cataloguing module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25728: Don't explode in the advanced editor
Bug-25728-Dont-explode-in-the-advanced-editor.patch (text/plain), 6.07 KB, created by
Katrin Fischer
on 2020-08-22 13:05:49 UTC
(
hide
)
Description:
Bug 25728: Don't explode in the advanced editor
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-08-22 13:05:49 UTC
Size:
6.07 KB
patch
obsolete
>From 207ec6689701f87f45bded08864f33c1298c8953 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 9 Jun 2020 17:34:30 +0200 >Subject: [PATCH] Bug 25728: Don't explode in the advanced editor > >Sponsored-by: Orex Digital > >Signed-off-by: Hugo Agud <hagud@orex.es> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 108 +++++++++++++------------- > 1 file changed, 54 insertions(+), 54 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js >index 3c4d6fbe87..807fc0a9a8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js >@@ -521,67 +521,67 @@ $(document).ready(function() { > $("input.input_marceditor, input.indicator").addClass('noEnterSubmit'); > }); > >- if ( CAN_user_parameters_manage_auth_values ) { >- var current_select2; >- $('.subfield_line select[data-category!=""]').select2({ >- tags: true, >- createTag: function (tag) { >- return { >- id: tag.term, >- text: tag.term, >- newTag: true >- }; >- }, >- templateResult: function(state) { >- if (state.newTag) { >- return state.text + " " + __("(select to create)"); >+ if ( window.editor === undefined ) { // TODO This does not work with the advanced editor >+ if ( CAN_user_parameters_manage_auth_values ) { >+ var current_select2; >+ $('.subfield_line select[data-category!=""]').select2({ >+ tags: true, >+ createTag: function (tag) { >+ return { >+ id: tag.term, >+ text: tag.term, >+ newTag: true >+ }; >+ }, >+ templateResult: function(state) { >+ if (state.newTag) { >+ return state.text + " " + __("(select to create)"); >+ } > } >- return state.text; >- } >- }).on("select2:select", function(e) { >- if(e.params.data.newTag){ >+ }).on("select2:select", function(e) { >+ if(e.params.data.newTag){ > >- var category = $(this).data("category"); >- $("#avCreate #new_av_category").html(category); >- $("#avCreate input[name='category']").val(category); >- $("#avCreate input[name='value']").val(e.params.data.text); >- $("#avCreate input[name='description']").val(e.params.data.text); >- $('#avCreate').modal({show:true}); >+ var category = $(this).data("category"); >+ $("#avCreate #new_av_category").html(category); >+ $("#avCreate input[name='category']").val(category); >+ $("#avCreate input[name='value']").val(e.params.data.text); >+ $("#avCreate input[name='description']").val(e.params.data.text); >+ $('#avCreate').modal({show:true}); > >- $(current_select2).val($(current_select2).find("option:first").val()).trigger('change'); >+ $(current_select2).val($(current_select2).find("option:first").val()).trigger('change'); > >- current_select2 = this; >- >- } >- }).on("select2:clear", function () { >- $(this).on("select2:opening.cancelOpen", function (evt) { >- evt.preventDefault(); >+ current_select2 = this; >+ } >+ }).on("select2:clear", function () { >+ $(this).on("select2:opening.cancelOpen", function (evt) { >+ evt.preventDefault(); > >- $(this).off("select2:opening.cancelOpen"); >+ $(this).off("select2:opening.cancelOpen"); >+ }); > }); >- }); > >- $("#add_new_av").on("submit", function(){ >- var data = { >- category: $(this).find('input[name="category"]').val(), >- value: $(this).find('input[name="value"]').val(), >- description: $(this).find('input[name="description"]').val(), >- opac_description: $(this).find('input[name="opac_description"]').val(), >- }; >- $.ajax({ >- type: "POST", >- url: "/api/v1/authorised_values", >- data:JSON.stringify(data), >- success: function(response) { >- $('#avCreate').modal('hide'); >- >- $(current_select2).append('<option selected value="'+data['value']+'">'+data['description']+'</option>'); >- }, >- error: function(err) { >- $("#avCreate .error").html(_("Something went wrong, maybe the value already exists?")) >- } >+ $("#add_new_av").on("submit", function(){ >+ var data = { >+ category: $(this).find('input[name="category"]').val(), >+ value: $(this).find('input[name="value"]').val(), >+ description: $(this).find('input[name="description"]').val(), >+ opac_description: $(this).find('input[name="opac_description"]').val(), >+ }; >+ $.ajax({ >+ type: "POST", >+ url: "/api/v1/authorised_values", >+ data:JSON.stringify(data), >+ success: function(response) { >+ $('#avCreate').modal('hide'); >+ >+ $(current_select2).append('<option selected value="'+data['value']+'">'+data['description']+'</option>'); >+ }, >+ error: function(err) { >+ $("#avCreate .error").html(_("Something went wrong, maybe the value already exists?")) >+ } >+ }); >+ return false; > }); >- return false; >- }); >+ } > } > }); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25728
:
105837
|
105838
|
105839
|
105840
|
105841
|
105842
|
105852
|
106696
|
106697
|
106698
|
106699
|
106700
|
106701
|
106702
|
108356
|
108357
|
108358
|
108359
|
108360
|
108361
|
108362
|
108883
|
108884
|
108885
|
108886
|
108887
|
108888
|
108889
|
108890
|
108922
|
108923
|
108924
|
108925
| 108926 |
108927
|
108928
|
108929
|
108930
|
108931