Improve modal behaviour

This commit is contained in:
Jay Trees 2022-02-24 13:59:07 +01:00
parent b1581d907c
commit 9a406ff382
2 changed files with 35 additions and 32 deletions

View file

@ -331,10 +331,7 @@ $(function () {
});
return false;
},
onDeny: function (element) {
return false;
},
}
})
.modal('show');
});
@ -377,16 +374,18 @@ $(function () {
elementModalFetch.find('input.current').val(href);
elementModalFetch.find('input.proposed').val(info.url);
elementButtons.addClass('disabled');
elementModalFetch
.modal({
allowMultiple: true,
closable: false,
onApprove: function (button) {
onApprove: function (buttonFetch) {
var formData = new URLSearchParams();
formData.append('product_url_current', href);
formData.append('product_url_proposed', info.url);
button.addClass('loading');
buttonFetch.addClass('loading');
fetch('/src/api/products.php', {
method: 'PUT',
@ -400,18 +399,22 @@ $(function () {
elementModalFetch.modal('hide');
}
button.removeClass('loading');
buttonFetch.removeClass('loading');
});
return false;
},
onHide: function() {
form.removeClass('loading');
elementButtons.removeClass('disabled');
}
})
.modal('show');
}
}
} else {
form.removeClass('loading');
elementButtons.removeClass('disabled');
}
}
});
});

View file

@ -143,7 +143,7 @@ if (isset($_POST['wishlist_delete_id'])) {
</div>
</div>
<div class="actions">
<div class="ui primary approve button">
<div class="ui primary approve button disabled">
Add
</div>
<div class="ui deny button">