package editor import ( "bytes" "strings" ) // SelectRepeater returns the []byte of a HTML element with a label. // IMPORTANT: // 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 FileRepeater(fieldName string, p interface{}, attrs map[string]string) []byte { name := tagNameFromStructField(fieldName, p) tmpl := `
Upload
` script := `` html := `` + tmpl + `` return append([]byte(html+script), RepeatController(fieldName, p, "input.store."+name, "div.file-input."+name)...) } // RepeatController generates the javascript to control any repeatable form // element in an editor based on its type, field name and HTML tag name func RepeatController(fieldName string, p interface{}, inputSelector, cloneSelector string) []byte { scope := tagNameFromStructField(fieldName, p) script := ` ` return []byte(script) }