Prefill the protocol name in modal when saving from template [SCI-8239]

This commit is contained in:
sboursen-scinote 2023-07-24 13:18:40 +02:00
parent e7c238ab3d
commit 634d4b6066
2 changed files with 5 additions and 0 deletions

View file

@ -26,6 +26,10 @@
.on('shown.bs.modal', function() {
$(`${protocolModal} #protocol_name`).parent().removeClass('error');
$(`${protocolModal} #protocol_name`).val('');
const protocolName = $(`a[data-target="${protocolModal}"]`).attr('data-protocol-name');
if (protocolName) {
$(this).find('.sci-input-field').val(protocolName);
}
$(this).find('.sci-input-field').focus();
})
.on('ajax:error', 'form', function(e, error) {

View file

@ -31,6 +31,7 @@
<a
data-toggle="modal"
data-target="#newProtocolModal"
v-bind:data-protocol-name="protocol.attributes.name"
:class="{ disabled: !protocol.attributes.urls.save_to_repo_url }"
>
<span class="fas fa-save"></span>