contact.html 6.4 KB

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