formidable/internal/server/template/blocks/form_input_array.html.tmpl

38 lines
1.6 KiB
Cheetah
Raw Normal View History

2022-03-22 09:21:55 +01:00
{{ define "form_input_array" }}
{{ $root := . }}
{{ $fullProperty := getFullProperty .Parent .Property }}
{{ $values := getValue .Defaults .Values $fullProperty }}
<table width="100%">
<tbody>
{{ range $index, $value := $values }}
{{ $itemFullProperty := printf "%s/%d" $fullProperty $index }}
{{ $itemProperty := printf "%d" $index }}
{{ $itemSchema := getItemSchema $root.Schema }}
{{ $formItemData := formItemData $root $itemProperty $itemSchema }}
<tr>
{{ template "form_row" $formItemData }}
</tr>
<tr>
<td></td>
<td colspan="2">
<input type="submit"
class="bg-red-600 text-white mb-2 px-3 py-1 rounded-md text-sm font-medium hover:bg-red-700 transition duration-300"
name="del:{{ $fullProperty }}/{{$index}}"
2022-05-09 14:23:23 +02:00
value="Remove" />
2022-03-22 09:21:55 +01:00
<hr />
</td>
</tr>
{{end}}
<tr>
<td colspan="2"></td>
<td align="right">
<input
class="bg-blue-500 text-white mb-2 mt-2 px-3 py-1 rounded-md text-sm font-medium hover:bg-blue-700 transition duration-300"
type="submit"
name="add:{{ $fullProperty }}/-"
2022-05-09 14:23:23 +02:00
value="Add" />
2022-03-22 09:21:55 +01:00
</td>
</tr>
</tbody>
</table>
{{ end }}