contact.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. {{ $ := .root }}
  2. {{ $st := .page }}
  3. {{ $autolink := default true $st.Params.content.autolink }}
  4. {{ $data := site.Params }}
  5. {{ $form_provider := lower $st.Params.content.form.provider | default "" }}
  6. {{ $form_provider_legacy := $st.Params.email_form | default 0 }}
  7. {{ $use_netlify_form := eq $form_provider "netlify" | or (eq $form_provider_legacy 1) }}
  8. {{ $use_formspree_form := eq $form_provider "formspree" | or (eq $form_provider_legacy 2) }}
  9. {{ $use_form := or $use_netlify_form $use_formspree_form }}
  10. {{ $use_netlify_captcha := $st.Params.content.form.netlify.captcha | default true }}
  11. {{ $columns := $st.Params.design.columns | default "2" }}
  12. <div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
  13. {{ with $st.Content }}{{ . }}{{ end }}
  14. {{ if $use_form }}
  15. {{ $post_action := "" }}
  16. {{ if $use_netlify_form }}
  17. {{ $post_action = "netlify" }}
  18. {{ else if $use_formspree_form }}
  19. {{ if not $st.Params.content.form.formspree.id }}
  20. {{ errorf "You have chosen to use Formspree as the provider for the contact form. Please set your Formspree Form ID in the Contact widget or disable the form." }}
  21. {{ errorf "Documentation: https://wowchemy.com/docs/page-builder/#contact" }}
  22. {{ end }}
  23. {{ $post_action = printf "action=\"https://formspree.io/f/%s\"" $st.Params.content.form.formspree.id }}
  24. {{end}}
  25. <div class="mb-3">
  26. <form name="contact" method="POST" {{ $post_action | safeHTMLAttr }} {{ if $use_netlify_form }}netlify-honeypot="welcome-bot"{{end}} {{ if $use_netlify_captcha }}data-netlify-recaptcha="true"{{end}}>
  27. <div class="form-group form-inline">
  28. <label class="sr-only" for="inputName">{{ i18n "contact_name" }}</label>
  29. <input type="text" name="name" class="form-control w-100" id="inputName" placeholder="{{ i18n "contact_name" | default "Name" }}" required>
  30. </div>
  31. <div class="form-group form-inline">
  32. <label class="sr-only" for="inputEmail">{{ i18n "contact_email" }}</label>
  33. <input type="email" name="email" class="form-control w-100" id="inputEmail" placeholder="{{ i18n "contact_email" | default "Email" }}" required>
  34. </div>
  35. <div class="form-group">
  36. <label class="sr-only" for="inputMessage">{{ i18n "contact_message" }}</label>
  37. <textarea name="message" class="form-control" id="inputMessage" rows="5" placeholder="{{ i18n "contact_message" | default "Message" }}" required></textarea>
  38. </div>
  39. {{ if $use_netlify_form }}
  40. <div class="d-none">
  41. <label>Do not fill this field unless you are a bot: <input name="welcome-bot"></label>
  42. </div>
  43. {{ if $use_netlify_captcha }}
  44. <div class="form-group" data-netlify-recaptcha="true"></div>
  45. {{ end }}
  46. {{ end }}
  47. <button type="submit" class="btn btn-primary px-3 py-2 w-100">{{ i18n "contact_send" | default "Send" }}</button>
  48. </form>
  49. </div>
  50. {{end}}
  51. <ul class="fa-ul">
  52. {{ with $data.gnupg_key }}
  53. <li>
  54. <i class="fa-li fa fa-key fa-2x" aria-hidden="true"></i>
  55. <code>gpg --recv-keys {{ . }}</code>
  56. </li>
  57. {{ end }}
  58. {{ if $data.email }}
  59. <li>
  60. <i class="fa-li fas fa-envelope fa-2x" aria-hidden="true"></i>
  61. <span id="person-email">
  62. {{- if $autolink }}<a href="mailto:{{ $data.email }}">{{ $data.email }}</a>{{ else }}{{ $data.email }}{{ end -}}
  63. </span>
  64. </li>
  65. {{ end }}
  66. {{ with $data.phone }}
  67. <li>
  68. <i class="fa-li fas fa-phone fa-2x" aria-hidden="true"></i>
  69. <span id="person-telephone">
  70. {{- if $autolink }}<a href="tel:{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end -}}
  71. </span>
  72. </li>
  73. {{ end }}
  74. {{ $addr_formatted := "" }}{{/* Scoping for maps. */}}
  75. {{ if $data.address.street | or $data.address.city | or $data.address.region | or $data.address.postcode | or $data.address.country }}
  76. {{ $addr_formatted = partial "functions/get_address" (dict "root" . "address" $data.address) }}
  77. <li>
  78. <i class="fa-li fas fa-map-marker fa-2x" aria-hidden="true"></i>
  79. <span id="person-address">{{$addr_formatted}}</span>
  80. </li>
  81. {{ end }}
  82. {{ with $data.directions }}
  83. <li>
  84. <i class="fa-li fas fa-compass fa-2x" aria-hidden="true"></i>
  85. <span>{{ . | markdownify | emojify }}</span>
  86. </li>
  87. {{ end }}
  88. {{ with $data.office_hours }}
  89. <li>
  90. <i class="fa-li fas fa-clock fa-2x" aria-hidden="true"></i>
  91. <span>
  92. {{- if not (reflect.IsSlice .)}}{{/* Support legacy string format. */}}
  93. {{- . | markdownify | emojify -}}
  94. {{else}}
  95. {{- delimit . "<br>" | markdownify | emojify -}}
  96. {{end -}}
  97. </span>
  98. </li>
  99. {{ end }}
  100. {{ with $data.appointment_url }}
  101. <li>
  102. <i class="fa-li fas fa-calendar-check fa-2x" aria-hidden="true"></i>
  103. <a href="{{ . }}" target="_blank" rel="noopener">{{ i18n "book_appointment" | default "Book an appointment" }}</a>
  104. </li>
  105. {{ end }}
  106. {{/* Contact links. */}}
  107. {{ range $data.contact_links }}
  108. {{ $pack := or .icon_pack "fas" }}
  109. {{ $pack_prefix := $pack }}
  110. {{ if in (slice "fab" "fas" "far" "fal") $pack }}
  111. {{ $pack_prefix = "fa" }}
  112. {{ end }}
  113. {{ $link := .link }}
  114. {{ $scheme := (urls.Parse $link).Scheme }}
  115. {{ $target := "" }}
  116. {{ if not $scheme }}
  117. {{ $link = .link | relLangURL }}
  118. {{ else if in (slice "http" "https") $scheme }}
  119. {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  120. {{ end }}
  121. <li>
  122. <i class="fa-li {{ $pack }} {{ $pack_prefix }}-{{ .icon }} fa-2x" aria-hidden="true"></i>
  123. <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}>{{.name|markdownify|emojify|safeHTML}}</a>
  124. </li>
  125. {{ end }}
  126. </ul>
  127. {{ if and site.Params.map.provider $data.coordinates.latitude }}
  128. <div class="d-none">
  129. <input id="map-provider" value="{{ lower site.Params.map.provider }}">
  130. <input id="map-lat" value="{{ $data.coordinates.latitude }}">
  131. <input id="map-lng" value="{{ $data.coordinates.longitude }}">
  132. <input id="map-dir" value="{{ $addr_formatted }}">
  133. <input id="map-zoom" value="{{ site.Params.map.zoom | default "15" }}">
  134. <input id="map-api-key" value="{{ site.Params.map.api_key }}">
  135. </div>
  136. <div id="map"></div>
  137. {{ end }}
  138. </div>