Skip to content

Commit ad0fcee

Browse files
committed
add support for array fields in the form page, closes #130
1 parent 7ff9747 commit ad0fcee

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/kaffy/resource_form.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ defmodule Kaffy.ResourceForm do
159159

160160
textarea(form, field, [value: value, rows: 4, placeholder: "JSON Content"] ++ opts)
161161

162+
{:array, _} ->
163+
value =
164+
data
165+
|> Map.get(field, "")
166+
|> Kaffy.Utils.json().encode!(escape: :html_safe, pretty: true)
167+
168+
textarea(form, field, [value: value, rows: 4, placeholder: "JSON Content"] ++ opts)
169+
162170
:file ->
163171
file_input(form, field, opts)
164172

0 commit comments

Comments
 (0)