Skip to content

Commit

Permalink
Add File Upload file handling. Still not supported on client side.
Browse files Browse the repository at this point in the history
  • Loading branch information
cybercase committed Mar 11, 2018
1 parent e733e23 commit 34e0961
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 289 deletions.
5 changes: 5 additions & 0 deletions app/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const FieldTypes = [
'time', // 10
'image', // 11
'video', // 12
'upload', // 13
]

Handlebars.registerHelper('ifType', function(field, typename, options) {
Expand Down Expand Up @@ -190,6 +191,10 @@ let bootstrapForm = Handlebars.compile(`
{{/if}}
{{/ifType}}
{{#ifType f 'upload'}}
<div>File upload is not yet implemented. Any help is welcome!</div>
{{/ifType}}
</div>
</fieldset>
{{/each}}
Expand Down
Binary file removed docs/fonts/glyphicons-halflings-regular.eot
Binary file not shown.
288 changes: 0 additions & 288 deletions docs/fonts/glyphicons-halflings-regular.svg

This file was deleted.

Binary file removed docs/fonts/glyphicons-halflings-regular.ttf
Binary file not shown.
Binary file removed docs/fonts/glyphicons-halflings-regular.woff
Binary file not shown.
Binary file removed docs/fonts/glyphicons-halflings-regular.woff2
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/scripts/main.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/formdress/form.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
FieldTime = 10
FieldImage = 11
FieldVideo = 12
FieldUpload = 13
)

type Widget map[string]interface{}
Expand Down Expand Up @@ -254,6 +255,20 @@ func NewFieldFromData(data []interface{}) Field {
},
}}

case FieldUpload:
widgets := toSlice(data[4])
widget := toSlice(widgets[0])
options := toSlice(widget[10])
f.Widgets = []Widget{{
"id": toString(widget[0]),
"required": toBool(widget[2]),
"options": Option{
"types": toSlice(options[1]),
"maxUploads": toInt(options[2]),
"maxSizeInBytes": toString(options[3]),
},
}}

case FieldSection:
fallthrough
case FieldTitle:
Expand Down

0 comments on commit 34e0961

Please sign in to comment.