From 1a19dc021c4cb301812139eb914d2ddc4328967b Mon Sep 17 00:00:00 2001 From: Marc Riera Irigoyen Date: Mon, 5 Mar 2018 11:19:53 +0100 Subject: [PATCH] Contact form --- content/contacta.ca.md | 50 ++++---------- .../crab/layouts/shortcodes/form-input.html | 65 ------------------- .../crab/layouts/shortcodes/form-option.html | 16 ----- .../crab/layouts/shortcodes/mult-input.html | 54 --------------- .../crab/layouts/shortcodes/netlify-form.html | 14 ---- 5 files changed, 14 insertions(+), 185 deletions(-) delete mode 100644 themes/crab/layouts/shortcodes/form-input.html delete mode 100644 themes/crab/layouts/shortcodes/form-option.html delete mode 100644 themes/crab/layouts/shortcodes/mult-input.html delete mode 100644 themes/crab/layouts/shortcodes/netlify-form.html diff --git a/content/contacta.ca.md b/content/contacta.ca.md index 7d4a682..0eae19a 100644 --- a/content/contacta.ca.md +++ b/content/contacta.ca.md @@ -8,39 +8,17 @@ menu: --- Pàgina no disponible temporalment. Disculpeu les molèsties. -{{< netlify-form name="bluestnight-survey" >}} - {{< form-input type="text" label="First name:" id="first-name" placeholder="Richard" required="true" >}} - {{< form-input type="text" label="Last name:" id="last-name" placeholder="Grayson" >}} - {{< form-input type="email" label="Reply-to email:" id="email" placeholder="r.grayson@wayneindustries.com" >}} - {{< mult-input type="radio" label="Do you use BluestNight on your website?" name="uses-theme" required="true" >}} - {{< form-option label="Yes" value="yes" >}} - {{< form-option label="No" value="no" selected="true" >}} - {{< /mult-input >}} - {{< form-input type="textarea" label="If yes, what has your experience been like?" id="dev-experience" >}} - {{< mult-input type="radio" name="why-not-use" label="If no, why not?" add_other="true" >}} - {{< form-option label="Not what I'm looking for" value="not looking for" >}} - {{< form-option label="Too confusing to use" value="confusing" >}} - {{< form-option label="I hadn't heard about it before" value="didn't know" >}} - {{< /mult-input >}} - {{< mult-input type="checkbox" name="theme-good-side" label="What, if anything, would you say BluestNight does well at?" add_other="true" >}} - {{< form-option label="Plenty of customization" value="customization" >}} - {{< form-option label="Detailed documentation" value="good docs" >}} - {{< form-option label="Pages load quickly" value="fast load" >}} - {{< form-option label="Developer friendly" value="dev-friendly" >}} - {{< form-option label="Responsive design" value="responsive design" >}} - {{< form-option label="Looks professional" value="looks professional" >}} - {{< /mult-input >}} - {{< form-input type="textarea" label="Explain:" id="good-theme-explanation" >}} - {{< mult-input type="checkbox" name="theme-bad-side" label="What, if anything, should be improved in BluestNight?" add_other="true" >}} - {{< form-option label="Site build time" value="build time" >}} - {{< form-option label="Too many features" value="fewer features" >}} - {{< form-option label="More approachable documentation" value="be approachable" >}} - {{< form-option label="Too many bugs" value="has bugs" >}} - {{< /mult-input >}} - {{< form-input type="textarea" label="Explain:" id="bad-theme-explanation" >}} - {{< form-input type="textarea" label="Is there anything else you would like to share?" id="anything-else" >}} - {{< mult-input type="radio" label="If you entered an email above, may I contact you for follow-up information?" name="can-email" required="true" >}} - {{< form-option label="Yes" value="yes" >}} - {{< form-option label="No/Didn't enter email" value="no" selected="true" >}} - {{< /mult-input >}} -{{< /netlify-form >}} +
+

+ +

+

+ +

+

+ +

+

+ +

+
diff --git a/themes/crab/layouts/shortcodes/form-input.html b/themes/crab/layouts/shortcodes/form-input.html deleted file mode 100644 index aafca10..0000000 --- a/themes/crab/layouts/shortcodes/form-input.html +++ /dev/null @@ -1,65 +0,0 @@ -
-
- -
-
- {{- $types := slice "color" "date" "datetime-local" "email" "file" "hidden" "month" "number" "password" "range" "tel" "text" "time" "url" "week" "textarea" -}} - {{- $type := .Get "type" -}} - {{- $id := .Get "id" -}} - {{- $name := (.Get "name" | default $id) -}} - {{- $placeholder := (.Get "placeholder" | default "") -}} - {{- $minlen := (.Get "minlength" | default "") -}} - {{- $maxlen := (.Get "maxlength" | default "") -}} - {{- $regex := (.Get "regex" | default "") -}} - {{- $value := (.Get "value" | default "") -}} - - {{- if gt (len (findRE "([^a-zA-Z0-9_\\-\\.])+" $id 1)) 0 -}} - {{- errorf "ID \"%s\" should not contains characters other than ASCII letters, digits, '_', '-', and '.'" $id -}} - {{- else if not (in $types $type) -}} - {{- if or (eq $type "checkbox") (eq $type "radio") -}} - {{- errorf "To use input type \"%s\", use the mult-input shortcode instead." $type -}} - {{- else -}} - {{- errorf "Input type \"%s\" for ID \"%s\" is invalid/not allowed.\nValid values are: " $type $id (delimit $types ", ") -}} - {{- end -}} - {{- else if ne (len (findRE "^(\\d)*$" $minlen)) 1 -}} - {{- errorf "Minimum length \"%s\" must be a whole number!" $minlen -}} - {{- else if ne (len (findRE "^(\\d)*$" $maxlen)) 1 -}} - {{- errorf "Maximum length \"%s\" must be a whole number!" $maxlen -}} - {{- end -}} - - {{- $.Scratch.Set "optional-tags" "" -}} - {{- with $placeholder -}}{{- $.Scratch.Add "optional-tags" (add (add " placeholder=\"" .) "\"") -}}{{- end -}} - {{- with $regex -}}{{- $.Scratch.Add "optional-tags" (add (add " pattern=\"" .) "\"") -}}{{- end -}} - {{- with $value -}}{{- $.Scratch.Add "optional-tags" (add (add " value=\"" .) "\"") -}}{{- end -}} - {{- with $minlen -}}{{- $.Scratch.Add "optional-tags" (add (add " minlength=\"" .) "\"") -}}{{- end -}} - {{- with $maxlen -}}{{- $.Scratch.Add "optional-tags" (add (add " maxlength=\"" .) "\"") -}}{{- end -}} - - {{- if or (or (eq $type "number") (eq $type "date")) (eq $type "range") -}} - {{- $min := (.Get "min" | default "") -}} - {{- $max := (.Get "max" | default "") -}} - {{- $step := (.Get "step" | default "") -}} - {{- with $min -}}{{- $.Scratch.Add "optional-tags" (add (add " min=\"" .) "\"") -}}{{- end -}} - {{- with $max -}}{{- $.Scratch.Add "optional-tags" (add (add " max=\"" .) "\"") -}}{{- end -}} - {{- with $step -}}{{- $.Scratch.Add "optional-tags" (add (add " step=\"" .) "\"") -}}{{- end -}} - {{- else if eq $type "file" -}} - {{- $accepts := .Get "accept" -}} - {{- $.Scratch.Add "optional-tags" (add (add " accept=\"" $accepts) "\"") -}} - {{- else if or (eq $type "file") (eq $type "email") -}} - {{- if eq (.Get "multiple") "true" -}} - {{- $.Scratch.Add "optional-tags" " multiple" -}} - {{- end -}} - {{- end -}} - - {{- if eq (.Get "required") "true" -}} - {{- $.Scratch.Add "optional-tags" " required" -}} - {{- end -}} - - {{- if eq $type "textarea" -}} - - {{- else if (in $types $type) -}} - - {{- else -}} - {{ errorf "If you are seeing this, please let the developer know at https://gitlab.com/BluestNight/BluestNight/issues\nInvalid input type \"%s\"" $type }} - {{- end -}} -
-
diff --git a/themes/crab/layouts/shortcodes/form-option.html b/themes/crab/layouts/shortcodes/form-option.html deleted file mode 100644 index b647dc7..0000000 --- a/themes/crab/layouts/shortcodes/form-option.html +++ /dev/null @@ -1,16 +0,0 @@ -{{- $type := .Parent.Get "type" -}} -{{- $name := .Parent.Get "name" -}} -{{- $value := .Get "value" -}} -{{- $label := .Get "label" -}} -{{- $selected := eq (.Get "selected") "true" -}} -{{- $required := or (and (eq $type "radio") (eq (.Parent.Get "required") "true")) (and (eq $type "checkbox") (eq (.Get "required") "true")) -}} -{{- if eq $type "select" -}} - -{{- else -}} -
  • - - -
  • -{{- end -}} diff --git a/themes/crab/layouts/shortcodes/mult-input.html b/themes/crab/layouts/shortcodes/mult-input.html deleted file mode 100644 index 38c8aa4..0000000 --- a/themes/crab/layouts/shortcodes/mult-input.html +++ /dev/null @@ -1,54 +0,0 @@ -
    - {{ $type := .Get "type" }} - {{ $name := .Get "name" }} - {{ $has_other := (eq (.Get "add_other") "true") }} - {{ $.Scratch.Set "form-input-type" $type }} - {{- if not (in (slice "checkbox" "radio" "select") $type) -}} - {{- errorf "Invalid multiple-choice input type \"%s\" - valid options are \"checkbox\", \"radio\", and \"select\"" -}} - {{- end -}} -
    - {{ if eq $type "select" }} - - {{ end }} -
    -
    - {{ if eq $type "select" }} - - {{ else }} -
      - {{ .Inner | safeHTML }} - {{ if $has_other }} -
    • - - - -
    • - {{ end }} -
    - {{ end }} -
    -
    -{{ if and (eq $type "select") $has_other }} -
    -
    - -
    -
    - -
    -
    -{{ end }} diff --git a/themes/crab/layouts/shortcodes/netlify-form.html b/themes/crab/layouts/shortcodes/netlify-form.html deleted file mode 100644 index 51dc68b..0000000 --- a/themes/crab/layouts/shortcodes/netlify-form.html +++ /dev/null @@ -1,14 +0,0 @@ -{{ $action := .Get "action" | default "thank-you" -}} -{{- if ne $action "thank-you" -}}{{- $action := ($action | absLangURL) -}}{{- end -}} -
    - - {{ .Inner }} -
    - - -
    -