hook_test/layouts/partials/widgets/contact.html

109 lines
4.2 KiB
HTML
Raw Permalink Normal View History

2021-12-31 12:44:26 +01:00
{{ $ := .root }}
{{ $page := .page }}
{{ $autolink := default true $page.Params.autolink }}
<!-- Contact widget -->
<div class="row contact-widget">
<div class="col-12 text-center section-heading">
<h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
</div>
<div class="col-12">
{{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
</div>
<div class="col-md-6">
{{ if $page.Params.email_form }}
{{ $post_action := "" }}
{{ if eq $page.Params.email_form 1 }}
{{ $post_action = "netlify" }}
{{ else }}
{{ if not site.Params.email }}
{{ errorf "Please set an email address for the contact form using the `email` parameter in `config.toml`. Otherwise, set `email_form = 0` to disable the contact form." }}
{{ end }}
{{ $post_action = printf "action=\"https://formspree.io/%s\"" site.Params.email }}
{{end}}
<div class="mb-3">
<form name="contact" method="POST" {{ $post_action | safeHTMLAttr }}>
<div class="form-group form-inline">
<label class="sr-only" for="inputName">{{ i18n "contact_name" }}</label>
<input type="text" name="name" class="form-control rounded-0 w-100" id="inputName"
placeholder="{{ i18n "contact_name" | default "Name" }}" required>
</div>
<div class="form-group form-inline">
<label class="sr-only" for="inputEmail">{{ i18n "contact_email" }}</label>
<input type="email" name="email" class="form-control rounded-0 w-100" id="inputEmail"
placeholder="{{ i18n "contact_email" | default "Email" }}" required>
</div>
<div class="form-group">
<label class="sr-only" for="inputMessage">{{ i18n "contact_message" }}</label>
<textarea name="message" class="form-control rounded-0" id="inputMessage" rows="5"
placeholder="{{ i18n "contact_message" | default "Message" }}" required></textarea>
</div>
<button type="submit"
class="btn btn-outline-primary px-3 py-2">{{ i18n "contact_send" | default "Envoyer" }}</button>
</form>
</div>
{{end}}
</div>
<div class="col-md-6">
<ul class="fa-ul" itemscope>
{{ if and site.Params.email (not $page.Params.email_form) }}
<li>
<i class="fa-li fas fa-envelope mt-2" aria-hidden="true"></i>
<span id="person-email" itemprop="email">
{{- if $autolink }}<a
href="mailto:{{ site.Params.email }}">{{ site.Params.email }}</a>{{ else }}{{ site.Params.email }}{{ end -}}
</span>
</li>
{{ end }}
{{ with site.Params.phone }}
<li>
<i class="fa-li fas fa-phone mt-2" aria-hidden="true"></i>
<span id="person-telephone" itemprop="telephone">
{{- if $autolink }}<a href="tel:{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end -}}
</span>
</li>
{{ end }}
{{ with site.Params.address }}
<li>
<i class="fa-li fas fa-map-marker-alt mt-2" aria-hidden="true"></i>
<span id="person-address" itemprop="address">{{ . | markdownify | emojify }}</span>
</li>
{{ end }}
{{ with site.Params.office_hours }}
<li>
<i class="fa-li fas fa-clock mt-2" aria-hidden="true"></i>
<span>{{ . | markdownify | emojify }}</span>
</li>
{{ end }}
{{ with site.Params.appointment_url }}
<li>
<i class="fa-li fas fa-calendar-check mt-2" aria-hidden="true"></i>
<a href="{{ . }}" target="_blank"
rel="noopener">{{ i18n "book_appointment" | default "Book an appointment" }}</a>
</li>
{{ end }}
</ul>
</div>
<div class="col-12">
{{ if site.Params.map }}
<div class="d-none">
<input id="map-provider" value="{{ site.Params.map }}">
<input id="map-lat" value="{{ site.Params.latitude }}">
<input id="map-lng" value="{{ site.Params.longitude }}">
<input id="map-dir" value="{{ site.Params.address }}">
<input id="map-zoom" value="{{ site.Params.zoom | default "15" }}">
<input id="map-api-key" value="{{ site.Params.map_api_key }}">
</div>
<div id="map"></div>
{{ end }}
</div>
</div>