From 012951fbf297d56e287e8a6b3ad813c03fab9f2e Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Sat, 1 Apr 2017 11:55:03 -0700 Subject: add warning message to console, new custom and hidden templates --- cmd/ponzu/generate.go | 2 ++ cmd/ponzu/templates/gen-custom.tmpl | 6 ++++++ cmd/ponzu/templates/gen-hidden.tmpl | 3 +++ 3 files changed, 11 insertions(+) create mode 100644 cmd/ponzu/templates/gen-custom.tmpl create mode 100644 cmd/ponzu/templates/gen-hidden.tmpl diff --git a/cmd/ponzu/generate.go b/cmd/ponzu/generate.go index adbf093..2b189a8 100644 --- a/cmd/ponzu/generate.go +++ b/cmd/ponzu/generate.go @@ -166,6 +166,8 @@ func setFieldView(field *generateField, viewType string) error { case "tags": case "custom": default: + msg := fmt.Sprintf("'%s' is not a recognized view type. Using 'input' instead.") + fmt.Println(msg) tmpl, err = tmplFrom("gen-input.tmpl") } diff --git a/cmd/ponzu/templates/gen-custom.tmpl b/cmd/ponzu/templates/gen-custom.tmpl new file mode 100644 index 0000000..a578d18 --- /dev/null +++ b/cmd/ponzu/templates/gen-custom.tmpl @@ -0,0 +1,6 @@ +View: []byte(` +
+ + +
+`), \ No newline at end of file diff --git a/cmd/ponzu/templates/gen-hidden.tmpl b/cmd/ponzu/templates/gen-hidden.tmpl new file mode 100644 index 0000000..4b00456 --- /dev/null +++ b/cmd/ponzu/templates/gen-hidden.tmpl @@ -0,0 +1,3 @@ +View: editor.Input("{{ .Name }}", {{ .Initial }}, map[string]string{ + "type": "hidden", +}), \ No newline at end of file -- cgit v1.2.3