#4 -- Now you can delete antecedents
Some checks failed
CI fuzzy controller / container-test-job (push) Failing after 1m15s
Some checks failed
CI fuzzy controller / container-test-job (push) Failing after 1m15s
This commit is contained in:
parent
aab9d010be
commit
311b8a4c5c
@ -139,6 +139,10 @@ function addFuzzyTermsSelect(variablesElement) {
|
|||||||
}
|
}
|
||||||
return fuzzyTermsElement;
|
return fuzzyTermsElement;
|
||||||
}
|
}
|
||||||
|
function removeAntecedent(buttonElement) {
|
||||||
|
$(buttonElement).parent().remove();
|
||||||
|
fuzzyTermsValueChanged();
|
||||||
|
}
|
||||||
|
|
||||||
function addAntecedent(parentElement, projectId) {
|
function addAntecedent(parentElement, projectId) {
|
||||||
rowElement = $("<div class='row'></div>");
|
rowElement = $("<div class='row'></div>");
|
||||||
@ -154,5 +158,8 @@ function addAntecedent(parentElement, projectId) {
|
|||||||
$(rowElement).append(variablesElement);
|
$(rowElement).append(variablesElement);
|
||||||
$(rowElement).append("<label class='col col-md-1 m-2'>есть</label>");
|
$(rowElement).append("<label class='col col-md-1 m-2'>есть</label>");
|
||||||
$(rowElement).append(fuzzyTermsElement);
|
$(rowElement).append(fuzzyTermsElement);
|
||||||
|
if ($(parentElement).find('.row').length) {
|
||||||
|
$(rowElement).append("<a href='#' class='btn btn-outline-dark m-2' onclick='removeAntecedent($(this))'>-</a>");
|
||||||
|
}
|
||||||
$(parentElement).append(rowElement);
|
$(parentElement).append(rowElement);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
}
|
}
|
||||||
$(el).html(ruleHtml);
|
$(el).html(ruleHtml);
|
||||||
}
|
}
|
||||||
$('.rule').each(function(index ) {
|
$('.rule').each(function(index) {
|
||||||
addRule(index, $(this), $(this).text());
|
addRule(index, $(this), $(this).text());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25,12 +25,15 @@
|
|||||||
Не может быть пустым
|
Не может быть пустым
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" id="rules">
|
|
||||||
<label class="col col-md-1 m-2">Если</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<a href="#" class="btn btn-outline-dark"
|
<label class="col col-md-1 m-2">Если</label>
|
||||||
th:onclick="addAntecedent($('#rules'), $('#projectId').val());">+</a>
|
<div id="rulesAntecedent"></div>
|
||||||
|
<div>
|
||||||
|
<a href="#" class="btn btn-outline-dark"
|
||||||
|
th:onclick="addAntecedent($('#rulesAntecedent'), $('#projectId').val());">+</a>
|
||||||
|
</div>
|
||||||
|
<label class="col col-md-1 m-2">То</label>
|
||||||
|
<div id="rulesConsequent"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button>
|
<button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button>
|
||||||
@ -48,7 +51,7 @@
|
|||||||
if ($('#ruleContent').val()) {
|
if ($('#ruleContent').val()) {
|
||||||
alert('123');
|
alert('123');
|
||||||
} else {
|
} else {
|
||||||
addAntecedent($('#rules'), [[${projectId}]]);
|
addAntecedent($('#rulesAntecedent'), [[${projectId}]]);
|
||||||
}
|
}
|
||||||
/*]]>*/
|
/*]]>*/
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user