diff --git a/encoding/html/templates/entity_page.gotpl b/encoding/html/templates/entity_page.gotpl index 2a5c5c9..4f272ef 100644 --- a/encoding/html/templates/entity_page.gotpl +++ b/encoding/html/templates/entity_page.gotpl @@ -1,4 +1,5 @@ {{ define "entity_page" }} + {{ template "entity_header" }} diff --git a/examples/html-template/templates/entity.gotpl b/examples/html-template/templates/entity.gotpl index 12133f5..42464e1 100644 --- a/examples/html-template/templates/entity.gotpl +++ b/examples/html-template/templates/entity.gotpl @@ -3,22 +3,25 @@ {{ with .Entity }}

-

+
+
{{- range $v := .Fields }} - {{ if eq $v.Key "ID" }} -
: {{ $v.Value }}
+ {{ if $v.IsID }} +
{{ $v.Value }}
{{ else }} {{ if eq $v.Type "time.Time" }} -
:
+
{{ else }} -
: {{ $v.Value }}
+
{{ $v.Value }}
{{ end }} {{ end }} {{- end }} +
+

{{ end }} {{ end }} diff --git a/examples/html-template/templates/entity_form.gotpl b/examples/html-template/templates/entity_form.gotpl index 5a9721f..dcace1d 100644 --- a/examples/html-template/templates/entity_form.gotpl +++ b/examples/html-template/templates/entity_form.gotpl @@ -2,31 +2,33 @@ {{ $pathPrefix := .PathPrefix }} {{ $method := "put" }} {{ with .Entity }} + {{ $id := (.ID | toString) }} - {{ if eq .ID 0 }} + {{ if eq $id "" }} {{ $method = "post" }} -
+ {{ else }} - + {{ end }} +
{{- range $f := .Fields }} - {{ if ne $f.Key "ID" }} - {{ if ne ($f.Value | toString) "0" }} -
- : - -
- {{ end }} + {{ if not $f.IsID }} +
+ + +
{{ else }} - {{ if ne ($f.Value | toString) "0" }} -
: {{ $f.Value }}
+
+ + {{ $f.Value }} +
- {{ end }} {{ end }} {{- end }} +
- +
{{ end }} {{ end }} diff --git a/examples/html-template/templates/entity_form_page.gotpl b/examples/html-template/templates/entity_form_page.gotpl index b97273b..07ddb6c 100644 --- a/examples/html-template/templates/entity_form_page.gotpl +++ b/examples/html-template/templates/entity_form_page.gotpl @@ -5,7 +5,9 @@ {{ template "entity_header" }} -

{{ .Name }}

+
+

{{ .Name }}

+
{{ template "entity_form" . }} diff --git a/examples/html-template/templates/entity_header.gotpl b/examples/html-template/templates/entity_header.gotpl index 38bcaf1..4562fd6 100644 --- a/examples/html-template/templates/entity_header.gotpl +++ b/examples/html-template/templates/entity_header.gotpl @@ -1,16 +1,8 @@ {{ define "entity_header" }} + + - {{ end }} diff --git a/examples/html-template/templates/entity_list.gotpl b/examples/html-template/templates/entity_list.gotpl index 4cca11e..317a470 100644 --- a/examples/html-template/templates/entity_list.gotpl +++ b/examples/html-template/templates/entity_list.gotpl @@ -1,16 +1,23 @@ {{ define "entity_list" }} {{ $pathPrefix := .PathPrefix }} -

- {{ .EntityName }} -
- - -
-

+
+

+ {{ .EntityName }} +

+
+
{{ range $k, $v := .Entities }} {{ $wrapped := wrapMetadata $pathPrefix $v }} {{ template "entity" $wrapped }} {{ end }} +
+ + {{ end }} diff --git a/examples/html-template/templates/entity_page.gotpl b/examples/html-template/templates/entity_page.gotpl index 2a5c5c9..cc3e1ba 100644 --- a/examples/html-template/templates/entity_page.gotpl +++ b/examples/html-template/templates/entity_page.gotpl @@ -1,11 +1,18 @@ {{ define "entity_page" }} + {{ template "entity_header" }} -

{{ .Name }}

- {{ template "entity" . }} +
+

{{ .Name }}

+
+
+
+ {{ template "entity" . }} +
+
{{ end }}