242 lines
14 KiB
HTML
242 lines
14 KiB
HTML
{{ $pageform := (index .context.Page.Params.forms .form) }}
|
|
{{ $group := slice }}
|
|
{{ $divide := .context.Page.Params.divide }}
|
|
<form id="generatorform">
|
|
|
|
|
|
{{ range $pageform.fields }}
|
|
{{ $title := .title }}
|
|
{{ $name := $title }}
|
|
{{ if .name }}
|
|
{{ $name = .name }}
|
|
{{ end }}
|
|
|
|
{{ if and .group (not (in $group .group))}}
|
|
<div class="margin_top_1rem">
|
|
{{ if i18n (singularize .group) }}{{ i18n (singularize .group) }}{{ else }}{{ humanize .group }}{{ end }}
|
|
{{ partial "tools/generator/expand" (dict "name" (printf "%sgroup" .group)) }}
|
|
</div>
|
|
{{ $group = $group | append .group }}
|
|
{{ end }}
|
|
|
|
{{ if eq .input_type "buttons" }}
|
|
<button onclick="button({{ .title }})" type="button" value="{{ .title }}">{{ .name }}</button>
|
|
|
|
{{ else if eq .input_type "title" }}
|
|
<h3 {{ if .group }}class="visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'"{{ end }}>{{- $name -}}{{- if .required -}}{{- " *" -}}{{- end -}}</h3>
|
|
{{ else if eq .input_type "textarea" }}
|
|
<div class="w100 {{ if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true' {{ end }}" style="flex-direction: column;">
|
|
<label class="w100 {{ if $pageform.names }}sr-only{{ end }}" for="{{ .title }}">{{- $name -}}{{- if .required -}}{{- " *" -}}{{- end -}}</label>
|
|
<div style="display: flex; flex-wrap: wrap;">
|
|
<button style="background: #8e3333;" class="button" type="button" value="Clear" onclick="clearThis({{ .title }});" />Clear</button>
|
|
{{ $button_target := .title }}
|
|
{{ range split .buttons ";"}}
|
|
{{ $b := split . ","}}
|
|
{{ $translation := index $b 1 }}
|
|
{{ $n := index $b 0 }}
|
|
{{ $nn := printf "%s;%s" $button_target $n}}
|
|
<button class="button tabs" onclick="button({{- $nn -}})" type="button" value="{{ $n }}">{{ $translation }}</button>
|
|
{{ end }}
|
|
</div>
|
|
<textarea class="w100 textarea" name="{{ .title }}" id="{{ .title }}" rows="10" {{ if .placeholder }}placeholder="{{ .placeholder }}"{{ end }}></textarea>
|
|
{{ if eq .title "content" }}
|
|
<div id="added-files" style="display: flex; flex-direction: column;"></div>
|
|
{{ end }}
|
|
</div>
|
|
{{ else if eq .input_type "radio" }}
|
|
<div class="radio {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
|
|
<label><input type="radio" name="{{ .title }}" id="{{ .title }}" value="{{ .name }}" {{ .Scratch.Get "requiredtext" }}>{{- $name -}}{{- if .required -}}{{- " *" -}}{{- end -}}</label>
|
|
</div>
|
|
{{ else if eq .input_type "checkbox" }}
|
|
<div class="w100 checkbox {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
|
|
<input type="checkbox" name="{{ .title }}" id="{{ .title }}" value="{{ .name }}">
|
|
<label for="{{ .title }}">{{- $name -}} <span class="font_size_smaller" style="font-size: smaller;"> ({{ if .help -}} {{ .help }}{{ end }})</span></label>
|
|
</div>
|
|
{{ else if eq .input_type "results" }}
|
|
<div id='result' class="w100"></div>
|
|
{{ else if eq .input_type "submit" }}
|
|
<div class="margin_top_1rem {{ if .group }}visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
|
|
<input type="{{ .input_type }}" value="{{- $name -}}" onsubmit="return false" onclick="showInput(event);" />
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{{ else if eq .input_type "mc" }}
|
|
{{ $in0 := .title }}
|
|
{{- $finale := slice -}}
|
|
{{ $pages := where site.RegularPages "Type" "in" site.Params.searchSections }}
|
|
{{ if eq .title "tags" }}
|
|
{{ range $pages }}
|
|
{{- with .Params.tags -}}
|
|
{{- $finale = $finale | append . -}}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ else if eq .title "foundations" }}
|
|
{{ range resources.Match "/images/foundations/*" }}
|
|
{{ $n := path.Base (strings.TrimSuffix (path.Ext .Name) .Name) }}
|
|
{{- $finale = $finale | append $n -}}
|
|
{{ end }}
|
|
{{ else }}
|
|
{{ range $pages }}
|
|
{{ range .Param $in0 }}
|
|
{{- $finale = $finale | append . -}}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{- $finale = $finale | uniq -}}
|
|
<div class="margin_top_1rem column {{ if .group }} visibleIf" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
|
|
<div class="w100 {{ if .group }}margin_left_1rem{{ end }}">
|
|
{{ .name }}
|
|
{{ if ne .expanded true }}{{ partial "tools/generator/expand" (dict "name" (printf "%scat" $in0)) }}{{ end }}{{- if .required -}}{{- " *" -}}{{- end -}}
|
|
</div>
|
|
<div class="checkbox {{ if ne .expanded true }}visibleIf margin_left_1rem stretch" data-visibleif-rule="{{ $in0 }}cat == 'true'{{end}}">
|
|
<div class="column margin_left_1rem">
|
|
<fieldset id="{{ $in0 }}" name="{{ $in0 }}" class="fieldset">
|
|
{{ range sort $finale }}
|
|
<label><input type="checkbox" name="{{ $in0 }}" id="{{ $in0 }}{{ . }}" value="{{ . }}" />{{ . }}</label>
|
|
{{ end }}
|
|
</fieldset>
|
|
{{ if .new }}
|
|
<label for="new{{- .title -}}">{{ .new }} <span class="font_size_smaller" style="font-size: smaller;">({{- $divide -}}{{- if .help -}}, {{ .help }}{{ end }})</span></label>
|
|
<input class="w100" type="text" name="new{{- .title -}}" id="new{{- .title -}}" value="" {{ if .placeholder }}placeholder="{{ .placeholder }}"{{ end }} />
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{ else if eq .input_type "rb" }}
|
|
{{ $in0 := .title }}
|
|
{{- $finale := slice -}}
|
|
{{ $pages := where site.RegularPages "Type" "in" site.Params.searchSections }}
|
|
{{ if eq .title "tags" }}
|
|
{{ range $pages }}
|
|
{{- with .Params.tags -}}
|
|
{{- $finale = $finale | append . -}}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ else if eq .title "foundations" }}
|
|
{{ range resources.Match "/images/foundations/*" }}
|
|
{{ $n := path.Base (strings.TrimSuffix (path.Ext .Name) .Name) }}
|
|
{{- $finale = $finale | append $n -}}
|
|
{{ end }}
|
|
{{ else }}
|
|
{{ range $pages }}
|
|
{{ range .Param $in0 }}
|
|
{{- $finale = $finale | append . -}}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{- $finale = $finale | uniq -}}
|
|
<div class="margin_top_1rem column {{ if .group }} visibleIf" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
|
|
<div class="w100 {{ if .group }}margin_left_1rem{{ end }}">
|
|
{{ .name }}
|
|
{{ if ne .expanded true }}{{ partial "tools/generator/expand" (dict "name" (printf "%scat" $in0)) }}{{ end }}{{- if .required -}}{{- " *" -}}{{- end -}}
|
|
</div>
|
|
<div class="checkbox {{ if ne .expanded true }}visibleIf margin_left_1rem stretch" data-visibleif-rule="{{ $in0 }}cat == 'true'{{end}}">
|
|
<div class="column margin_left_1rem">
|
|
<fieldset id="{{ $in0 }}" name="{{ $in0 }}" class="fieldset">
|
|
<input class="button" type="button" value="Clear" onclick="Clear({{ $in0 }});">
|
|
{{ range sort $finale }}
|
|
<label><input type="radio" name="{{ $in0 }}" id="{{ $in0 }}{{ . }}" value="{{ . }}" />{{ . }}</label>
|
|
{{ end }}
|
|
</fieldset>
|
|
{{ if .new }}
|
|
<label for="new{{- .title -}}">{{ .new }} <span class="font_size_smaller" style="font-size: smaller;">({{- $divide -}}{{- if .help -}}, {{ .help }}{{ end }})</span></label>
|
|
<input class="w100" type="text" name="new{{- .title -}}" id="new{{- .title -}}" value="" {{ if .placeholder }}placeholder="{{ .placeholder }}"{{ end }} />
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{ else if eq .input_type "categories" }}
|
|
{{ $in0 := .title }}
|
|
{{- $finale := slice -}}
|
|
{{ $pages := where site.RegularPages "Type" "in" site.Params.searchSections }}
|
|
{{ if eq .title "tags" }}
|
|
{{ range $pages }}
|
|
{{- with .Params.tags -}}
|
|
{{- $finale = $finale | append . -}}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ else if eq .title "foundations" }}
|
|
{{ range resources.Match "/images/foundations/*" }}
|
|
{{ $n := path.Base (strings.TrimSuffix (path.Ext .Name) .Name) }}
|
|
{{- $finale = $finale | append $n -}}
|
|
{{ end }}
|
|
{{ else }}
|
|
{{ range $pages }}
|
|
{{ range .Param $in0 }}
|
|
{{- $finale = $finale | append . -}}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{- $finale = $finale | uniq -}}
|
|
<div class="margin_top_1rem column {{ if .group }} visibleIf" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
|
|
<div class="w100 {{ if .group }}margin_left_1rem{{ end }}">
|
|
{{ .name }}
|
|
{{ if ne .expanded true }}{{ partial "tools/generator/expand" (dict "name" (printf "%scat" $in0)) }}{{ end }}{{- if .required -}}{{- " *" -}}{{- end -}}
|
|
</div>
|
|
<div class="column checkbox {{ if ne .expanded true }}visibleIf margin_left_1rem stretch" data-visibleif-rule="{{ $in0 }}cat == 'true'{{end}}">
|
|
{{ $direction := "row" }}
|
|
{{ if .direction }}
|
|
{{ $direction = .direction }}
|
|
{{ end }}
|
|
<div class="margin_left_1rem" style="display: flex; flex: 0 1 auto; flex-wrap: wrap;">
|
|
<button style="background: #8e3333;" class="button" type="button" value="Clear" onclick="clearThis({{ .title }});" />Clear</button>
|
|
{{ $button_target := .title }}
|
|
{{ range sort $finale }}
|
|
{{ if . }}
|
|
{{ $n := . }}
|
|
{{ $nn := printf "%s;%s" $button_target $n}}
|
|
<button class="button" onclick="Input({{- $nn -}})" type="button" value="{{ $n }}">{{ $n }}</button>
|
|
{{ end }}
|
|
{{ end }}
|
|
</div>
|
|
<label for="{{- .title -}}"><span class="font_size_smaller" style="font-size: smaller;">({{- $divide -}}{{- if .help -}}, {{ .help }}{{ end }})</span></label>
|
|
<input class="w100" type="text" name="{{ $in0 }}" id="{{ $in0 }}" value="" {{ if .placeholder }}placeholder="{{ .placeholder }}"{{ end }} />
|
|
</div>
|
|
</div>
|
|
|
|
{{ else }}
|
|
{{ if eq .title "name" }}
|
|
<div class="half {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
|
|
<label class="{{ if $pageform.names }}sr-only{{ end }}" for="firstname">First name{{- if .required -}}{{- " *" -}}{{- end -}}</label>
|
|
<input type="text" name="firstname" id="firstname" {{ if $pageform.names }}placeholder="First name{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
|
|
</div>
|
|
<div class="half {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
|
|
<label class="{{ if $pageform.names }}sr-only{{ end }}" for="lastname">Last name{{- if .required -}}{{- " *" -}}{{- end -}}</label>
|
|
<input type="text" name="lastname" id="lastname" {{ if $pageform.names }}placeholder="Last name{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
|
|
</div>
|
|
{{ else if eq .title "address" }}
|
|
<div {{- if .group }} class="visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'"{{ end -}}>
|
|
<label class="{{ if $pageform.names }}sr-only{{ end }}" for="address">Address{{- if .required -}}{{- " *" -}}{{- end -}}</label>
|
|
<input type="text" name="address" id="address" {{ if $pageform.names }}placeholder="Address{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
|
|
</div>
|
|
<div class="half {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true{{ end }}">
|
|
<label class="{{ if $pageform.names }}sr-only{{ end }}" for="city">City{{- if .required -}}{{- " *" -}}{{- end -}}</label>
|
|
<input type="text" name="city" id="city" {{ if $pageform.names }}placeholder="City{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
|
|
</div>
|
|
|
|
<div class="half {{- if .group }} visibleIf margin_left_1rem" data-visibleif-rule="{{ .group }}group == 'true'{{ end }}">
|
|
<label class="{{ if $pageform.names }}sr-only{{ end }}" for="postalcode">Postal code{{- if .required -}}{{- " *" -}}{{- end -}}</label>
|
|
<input type="text" name="postalcode" id="postalcode" {{ if $pageform.names }}placeholder="Postal code{{ .Scratch.Get "requiredstar" }}"{{ end }} {{ .Scratch.Get "requiredtext" }}>
|
|
</div>
|
|
{{ else }}
|
|
<div class="margin_top_1rem w100 {{ if .group }} visibleIf stretch margin_left_1rem" data-visibleif-rule=" {{ .group }}group == 'true' {{ end }}">
|
|
<div class="column w100">
|
|
<label class="w100 {{ if $pageform.names }}sr-only{{ end }}" for="{{ .title }}">{{ .name }}{{- if .required -}}{{- " *" -}}{{- end -}}{{- if .help }} ({{ .help }}){{ end }}</label>
|
|
<input class="w100" type="{{ .input_type }}" name="{{ .title }}" id="{{ .title }}" placeholder="{{ .placeholder }}">
|
|
</div>
|
|
</div>
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
</form>
|