From cd263f3fb3626c8853ed1fcbd92a8febaca055ec Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Wed, 5 Oct 2016 10:15:34 -0700 Subject: adding implementation for file upload input and viewing existing upload --- management/editor/elements.go | 72 +++++++++++++++++++++++++++-- system/admin/static/dashboard/css/admin.css | 41 +++++++++++++++- 2 files changed, 108 insertions(+), 5 deletions(-) diff --git a/management/editor/elements.go b/management/editor/elements.go index c5dd4ee..5667faa 100644 --- a/management/editor/elements.go +++ b/management/editor/elements.go @@ -42,7 +42,73 @@ func Textarea(fieldName string, p interface{}, attrs map[string]string) []byte { // The `fieldName` argument will cause a panic if it is not exactly the string // form of the struct field that this editor input is representing func File(fieldName string, p interface{}, attrs map[string]string) []byte { - return nil + name := tagNameFromStructField(fieldName, p) + tmpl := + `
+ +
+
+ Upload + +
+
+ +
+
+
+ +
` + + script := + `` + + return []byte(tmpl + script) } // Richtext returns the []byte of a rich text editor (provided by http://summernote.org/) with a label. @@ -76,7 +142,7 @@ func Richtext(fieldName string, p interface{}, attrs map[string]string) []byte { iso = append(iso, []byte(input)...) iso = append(iso, isoClose...) - initializer := ` + script := ` ` - return append(iso, []byte(initializer)...) + return append(iso, []byte(script)...) } // Select returns the []byte of a