UI fixes on type fields

This commit is contained in:
roberto 2024-12-24 10:28:45 +01:00
parent 75178634de
commit 2e4a1720cd
4 changed files with 20 additions and 12 deletions

View File

@ -203,7 +203,7 @@ input, select, textarea{
border: 1px solid #ccc !important;
width: 100%;
font: inherit;
padding: 8px;
padding: 6px;
border-radius: 4px;
}

View File

@ -182,6 +182,20 @@ function bm_item_field_undelete(sender, field_name) {
document.getElementById('FieldsValues-' + field_name).classList.remove('field-opaque');
}
function bm_type_field_delete(sender, type_field_id) {
document.getElementById('Fields-' + type_field_id + '-ToRemove').value = '1';
sender.hidden = true;
document.getElementById('Undelete-' + type_field_id).hidden = false;
document.getElementById('Field-' + type_field_id).classList.add('field-opaque');
}
function bm_type_field_undelete(sender, type_field_id) {
document.getElementById('Fields-' + type_field_id + '-ToRemove').value = '';
sender.hidden = true;
document.getElementById('Delete-' + type_field_id).hidden = false;
document.getElementById('Field-' + type_field_id).classList.remove('field-opaque');
}
function bm_showMessage() {
document.getElementById('message').show();
setTimeout(() => {

View File

@ -19,6 +19,7 @@
{{ widget_select (print "Fields-" .Type_field_id "-Ui_section") "Section" "general" $.uisections `class=" w3-border"` }}
</div>
</div>
<div class="row">
<p>
{{ widget_checkbox "Fields-New-{{.counter}}-Show_on_list" "Show on list" "1" .Show_on_list }}
@ -30,9 +31,8 @@
{{ widget_checkbox "Fields-New-{{.counter}}-Is_multiple" "Multiple" "1" .Is_multiple }}
</p>
</div>
<div class="bar">
<button type="button" _="on click remove #field-new-{{.counter}}" class="delete"><i class="bi bi-file-minus" title="Remove"></i><span class="hide-small"> Remove</span></button>
<button type="button" onclick="document.getElementById('field-new-{{.counter}}').remove()" class="delete"><i class="bi bi-file-minus" title="Remove"></i><span class="hide-small"> Remove</span></button>
</div>
</div>
{{ end }}

View File

@ -21,6 +21,7 @@
{{ widget_select (print "Fields-" .Type_field_id "-Ui_section") "Section" .Ui_section $.uisections `class=" w3-border"` }}
</div>
</div>
<div class="row">
<p>
{{ widget_checkbox "Fields-{{.Type_field_id}}-Show_on_list" "Show on list" "1" .Show_on_list }}
@ -35,15 +36,8 @@
<input type="hidden" id="Fields-{{.Type_field_id}}-ToRemove" name="Fields-{{.Type_field_id}}-ToRemove" value=""/>
</div>
<div class="bar">
<button id="Delete-{{.Type_field_id}}" type="button" class="delete"
_="on click set {value: '1'} on #Fields-{{.Type_field_id}}-ToRemove then hide me then show #Undelete-{{.Type_field_id}} then add .w3-opacity-max to #Field-{{.Type_field_id}}"
>
<i class="bi bi-file-minus" title="Remove"></i><span class="hide-small"> Remove</span>
</button>
<button id="Undelete-{{.Type_field_id}}" style="margin-right: 5px;" hidden type="button" class="delete"
_="on click set {value: ''} on #Fields-{{.Type_field_id}}-ToRemove then hide me then show #Delete-{{.Type_field_id}} then remove .w3-opacity-max from #Field-{{.Type_field_id}}">
<i class="bi bi-arrow-counterclockwise" title="Undo"></i><span class="hide-small"> Undo</span>
</button>
<button id="Delete-{{.Type_field_id}}" type="button" class="delete" onclick="bm_type_field_delete(this, '{{.Type_field_id}}')"><i class="bi bi-file-minus" title="Remove"></i><span class="hide-small"> Remove</span></button>
<button id="Undelete-{{.Type_field_id}}" style="margin-right: 5px;" hidden type="button" class="delete" onclick="bm_type_field_undelete(this, '{{.Type_field_id}}')"><i class="bi bi-arrow-counterclockwise" title="Undo"></i><span class="hide-small"> Undo</span></button>
</div>
</div>
{{ end }}