Files
site/themes/minimo/layouts/partials/comments/staticman/form.html
2021-09-06 13:02:12 -04:00

76 lines
2.9 KiB
HTML

{{- $staticman := ( partialCached "comments/staticman/GetStaticmanYML" . ) -}}
{{- $config := .Site.Params.comments.staticman -}}
{{- $apiEndpoint := $config.apiEndpoint -}}
{{- $username := $config.github.username | default $config.username -}}
{{- $repo := $config.github.repository | default $config.repository -}}
{{- $_branch := $config.github.branch | default $config.branch -}}
{{- $branch := $_branch | default $staticman.comments.branch -}}
{{- $api := ( print $apiEndpoint "/" $username "/" $repo "/" $branch ) -}}
{{- $reCaptcha := $staticman.comments.reCaptcha | default ( dict "enabled" false ) -}}
<div id='respond' class='comment-respond'>
<h4 class='comment-reply-title'>
{{- i18n "leaveAComment" -}}
<small>
<a rel='nofollow' id='cancel-comment-reply-link' href='#respond' class='button' style='display:none' aria-label='{{ i18n "cancelComment" }}'>
{{- i18n "cancel" -}}
</a>
</small>
</h4>
<form action='{{ $api }}/comments' method='post' id='comment-form' class='comment-form'>
<input type='hidden' name='options[postId]' value='{{ .File.UniqueID }}'>
<input type='hidden' name='options[redirect]' value='{{ .Permalink }}#submission-success'>
<input type='hidden' name='options[redirectError]' value='{{ .Permalink }}#submission-failure'>
<input type='address' name='fields[honeypot]' style='display:none'>
<input type='hidden' name='fields[permalink]' value='{{ .RelPermalink }}'>
<input type='hidden' name='fields[parent_id]' value=''>
{{- if $reCaptcha.enabled -}}
<input type='hidden' name='options[reCaptcha][siteKey]' value='{{ $reCaptcha.siteKey }}'>
<input type='hidden' name='options[reCaptcha][secret]' value='{{ $reCaptcha.secret }}'>
{{- end -}}
<div>
<label for='comment'>{{ i18n "comment" }}*</label>
<textarea id='comment' name='fields[content]' required rows='3'></textarea>
</div>
<div>
<label for='name'>{{ i18n "name" }}*</label>
<input id='name' name='fields[author]' type='text' required>
</div>
<div>
<label for='email'>{{ i18n "email" }}*</label>
<input id='email' name='fields[email]' type='email' required>
</div>
<div>
<label for='url'>{{ i18n "website" }}</label>
<input id='url' name='fields[site]' type='url'>
</div>
{{- if $reCaptcha.enabled -}}
<div class='g-recaptcha' data-sitekey='{{ $reCaptcha.siteKey }}' data-callback="enableSubmitComment"></div>
<script type="text/javascript">
function enableSubmitComment(){
document.getElementById("submitComment").disabled = false;
}
</script>
<script async src='https://www.google.com/recaptcha/api.js'></script>
{{- end -}}
<div>
<button type='submit' id="submitComment" {{- with $reCaptcha.enabled }} disabled {{- end }}>
{{- i18n "submitComment" -}}
</button>
</div>
</form>
</div>