contact.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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.phone }}
  68. <li>
  69. <i class="fa-li fas fa-phone fa-2x" aria-hidden="true"></i>
  70. <span id="person-telephone">
  71. {{- if $autolink }}<a href="tel:{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end -}}
  72. </span>
  73. </li>
  74. {{ end }}
  75. {{ $addr_formatted := "" }}{{/* Scoping for maps. */}}
  76. {{ if $data.address.street | or $data.address.city | or $data.address.region | or $data.address.postcode | or $data.address.country }}
  77. {{ $addr_formatted = partial "functions/get_address" (dict "root" . "address" $data.address) }}
  78. <li>
  79. <i class="fa-li fas fa-map-marker fa-2x" aria-hidden="true"></i>
  80. <span id="person-address">{{$addr_formatted}}</span>
  81. </li>
  82. {{ end }}
  83. {{ with $data.directions }}
  84. <li>
  85. <i class="fa-li fas fa-compass fa-2x" aria-hidden="true"></i>
  86. <span>{{ . | markdownify | emojify }}</span>
  87. </li>
  88. {{ end }}
  89. {{ with $data.office_hours }}
  90. <li>
  91. <i class="fa-li fas fa-clock fa-2x" aria-hidden="true"></i>
  92. <span>
  93. {{- if not (reflect.IsSlice .)}}{{/* Support legacy string format. */}}
  94. {{- . | markdownify | emojify -}}
  95. {{else}}
  96. {{- delimit . "<br>" | markdownify | emojify -}}
  97. {{end -}}
  98. </span>
  99. </li>
  100. {{ end }}
  101. {{ with $data.appointment_url }}
  102. <li>
  103. <i class="fa-li fas fa-calendar-check fa-2x" aria-hidden="true"></i>
  104. <a href="{{ . }}" target="_blank" rel="noopener">{{ i18n "book_appointment" | default "Book an appointment" }}</a>
  105. </li>
  106. {{ end }}
  107. {{/* Contact links. */}}
  108. {{ range $data.contact_links }}
  109. {{ $pack := or .icon_pack "fas" }}
  110. {{ $pack_prefix := $pack }}
  111. {{ if in (slice "fab" "fas" "far" "fal") $pack }}
  112. {{ $pack_prefix = "fa" }}
  113. {{ end }}
  114. {{ $link := .link }}
  115. {{ $scheme := (urls.Parse $link).Scheme }}
  116. {{ $target := "" }}
  117. {{ if not $scheme }}
  118. {{ $link = .link | relLangURL }}
  119. {{ else if in (slice "http" "https") $scheme }}
  120. {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  121. {{ end }}
  122. <li>
  123. <i class="fa-li {{ $pack }} {{ $pack_prefix }}-{{ .icon }} fa-2x" aria-hidden="true"></i>
  124. <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}>{{.name|markdownify|emojify|safeHTML}}</a>
  125. </li>
  126. {{ end }}
  127. </ul>
  128. {{ if and site.Params.map.engine $data.coordinates.latitude }}
  129. <div class="d-none">
  130. <input id="map-provider" value="{{ site.Params.map.engine }}">
  131. <input id="map-lat" value="{{ $data.coordinates.latitude }}">
  132. <input id="map-lng" value="{{ $data.coordinates.longitude }}">
  133. <input id="map-dir" value="{{ $addr_formatted }}">
  134. <input id="map-zoom" value="{{ site.Params.map.zoom | default "15" }}">
  135. <input id="map-api-key" value="{{ site.Params.map.api_key }}">
  136. </div>
  137. <div id="map"></div>
  138. {{ end }}
  139. </div>
  140. </div>