This commit is contained in:
roberto 2024-12-23 19:01:36 +01:00
parent 9e87894a7c
commit 75178634de
3 changed files with 26 additions and 81 deletions

View File

@ -1,92 +1,38 @@
{{define "type:field_new"}}
<div
class="w3-card"
id="field-new-{{.counter}}"
style="padding: 10px; margin-top: 10px"
>
<div class="w3-row">
<div class="w3-half">
{{ widget_select (print "Fields-New-" .counter "-Widget_id") "Widget" "" .widgets `class=" w3-border"` }}
<div class="card" id="field-new-{{.counter}}" style="padding: 10px; margin-top: 10px">
<div class="row">
<div class="col half">
{{ widget_select (print "Fields-New-" .counter "-Widget_id") "Widget" "" .widgets `` }}
</div>
<div class="w3-half">
<div class="col half">
<label for="Fields-New-{{.counter}}-Title">Title</label>
<input
class=" w3-border"
type="text"
id="Fields-New-{{.counter}}-Title"
name="Fields-New-{{.counter}}-Title"
value=""
/>
<input type="text" id="Fields-New-{{.counter}}-Title" name="Fields-New-{{.counter}}-Title" value=""/>
</div>
</div>
<div class="w3-row">
<div class="w3-half">
<label for="Fields-New-{{.counter}}-Attributes">Attributes</label>
<input
class=" w3-border"
type="text"
id="Fields-New-{{.counter}}-Attributes"
name="Fields-New-{{.counter}}-Attributes"
value=""
/>
</div>
<div class="w3-half">
<div class="row">
<div class="col half">
<label for="Fields-New-{{.counter}}-Valid_values">Valid values</label>
<input
class=" w3-border"
type="text"
id="Fields-New-{{.counter}}-Valid_values"
name="Fields-New-{{.counter}}-Valid_values"
value=""
/>
<input type="text" id="Fields-New-{{.counter}}-Valid_values" name="Fields-New-{{.counter}}-Valid_values" value=""/>
</div>
</div>
<div class="w3-row">
<div class="w3-half">
<p>
<input
id="Fields-New-{{.counter}}-Show_on_list"
name="Fields-New-{{.counter}}-Show_on_list"
class=""
type="checkbox"
value="1"
/>
<label for="Fields-New-{{.counter}}-Show_on_list">Show on list</label>
</p>
<p>
<input
id="Fields-New-{{.counter}}-Show_on_view"
name="Fields-New-{{.counter}}-Show_on_view"
class=""
type="checkbox"
value="1"
/>
<label for="Fields-New-{{.counter}}-Show_on_view">Show on view</label>
</p>
<p>
<input
id="Fields-New-{{.counter}}-Is_multiple"
name="Fields-New-{{.counter}}-Is_multiple"
class=""
type="checkbox"
value="1"
/>
<label for="Fields-New-{{.counter}}-Is_multiple">Multiple</label>
</p>
</div>
<div class="w3-half">
<div class="col half">
{{ widget_select (print "Fields-" .Type_field_id "-Ui_section") "Section" "general" $.uisections `class=" w3-border"` }}
</div>
</div>
<div class="w3-bar">
<button
type="button"
_="on click remove #field-new-{{.counter}}"
class="w3-right w3-btn w3-metro-dark-red w3-round-large"
>
<i class="bi bi-file-minus" title="Remove"></i><span class="hide-small"> Remove</span>
</button>
<div class="row">
<p>
{{ widget_checkbox "Fields-New-{{.counter}}-Show_on_list" "Show on list" "1" .Show_on_list }}
</p>
<p>
{{ widget_checkbox "Fields-New-{{.counter}}-Show_on_view" "Show on view" "1" .Show_on_view }}
</p>
<p>
{{ 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>
</div>
</div>
{{ end }}

View File

@ -34,7 +34,7 @@
</div>
<input type="hidden" id="Fields-{{.Type_field_id}}-ToRemove" name="Fields-{{.Type_field_id}}-ToRemove" value=""/>
</div>
<div class="sbar">
<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}}"
>

View File

@ -402,7 +402,6 @@ func widget_checkbox(name string, label string, value string, value_assigned any
switch v := value_assigned.(type) {
case int:
value_assigned_str = strconv.Itoa(v)
case int64: