fix label delete js
@@ -90,6 +90,7 @@ $(document).ready(function () {
// Bind ajax submit events to favorite and label buttons
$("#item-selectors").on("click", ".btn-inline-favorite, .btn-label-remove", label_ajax_submit);
$("#btn-create-label").click(label_ajax_submit);
+ $(".btn-label-remove").click(label_ajax_submit);
$("#filter input[type='checkbox']").on("change", function () {
resourceTable.draw();
@@ -382,6 +383,9 @@ function errorLabel(message) {
function label_ajax_submit() {
var el = $(this);
+ var formType = el.attr("data-form-type");
+
+ if (formType == "create-label"){
var labelText = $("#txtLabelName").val();
var sanitizedLabelText = $("<div/>").html(labelText.trim()).text();
let message = "";
@@ -403,11 +407,12 @@ function label_ajax_submit() {
$("#txtLabelName").addClass("invalid-input");
return;
}
+ }
+
$("#txtLabelName").val(labelText);
var form = $("form[data-id='" + el.attr("data-form-id") + "']");
var datastring = form.serialize();
var url = form.attr('action');
- var formType = el.attr("data-form-type");
var tableRow = form.closest("tr");
$.ajax({
@@ -662,7 +667,6 @@ function createLabel () {
userLabelsTable.find(".no-items-found").remove();
- $(".btn-label-remove").click(label_ajax_submit);
$("#modalCreateLabel").modal('hide');
$("#txtLabelName").val("");
updateLabelsList();
