#4 -- Read rule string #20
@ -139,6 +139,10 @@ function addFuzzyTermsSelect(variablesElement) {
|
||||
}
|
||||
return fuzzyTermsElement;
|
||||
}
|
||||
function removeAntecedent(buttonElement) {
|
||||
$(buttonElement).parent().remove();
|
||||
fuzzyTermsValueChanged();
|
||||
}
|
||||
|
||||
function addAntecedent(parentElement, projectId) {
|
||||
rowElement = $("<div class='row'></div>");
|
||||
@ -154,5 +158,8 @@ function addAntecedent(parentElement, projectId) {
|
||||
$(rowElement).append(variablesElement);
|
||||
$(rowElement).append("<label class='col col-md-1 m-2'>есть</label>");
|
||||
$(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);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@
|
||||
}
|
||||
$(el).html(ruleHtml);
|
||||
}
|
||||
$('.rule').each(function(index ) {
|
||||
$('.rule').each(function(index) {
|
||||
addRule(index, $(this), $(this).text());
|
||||
});
|
||||
|
||||
|
@ -25,12 +25,15 @@
|
||||
Не может быть пустым
|
||||
</p>
|
||||
</div>
|
||||
<div class="form-group" id="rules">
|
||||
<label class="col col-md-1 m-2">Если</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<a href="#" class="btn btn-outline-dark"
|
||||
th:onclick="addAntecedent($('#rules'), $('#projectId').val());">+</a>
|
||||
<label class="col col-md-1 m-2">Если</label>
|
||||
<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 class="form-group">
|
||||
<button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button>
|
||||
@ -48,7 +51,7 @@
|
||||
if ($('#ruleContent').val()) {
|
||||
alert('123');
|
||||
} else {
|
||||
addAntecedent($('#rules'), [[${projectId}]]);
|
||||
addAntecedent($('#rulesAntecedent'), [[${projectId}]]);
|
||||
}
|
||||
/*]]>*/
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user