Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
79 lines (63 sloc) 3.04 KB
<section class="comment_form">
{{ $temp := (replace .URL "/" "") | replaceRE `^([1-2][0-9])\d\d(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])` "" }}
{{ $temp2 := .File.BaseFileName }}
{{ if eq .File.BaseFileName "index" }}
{{ $.Scratch.Add "post_parent" $temp }}
{{ else }}
{{ $.Scratch.Add "post_parent" $temp2 }}
{{ end }}
<a id="comment-form"></a>
<h3>Say something</h3>
<form class="js-form form" method="POST" action="{{ .Site.Params.staticman_api }}">
<input type="hidden" name="options[redirect]" value="{{ .Permalink }}#post-submitted">
<input type="hidden" name="options[redirectError]" value="{{ .Permalink }}#post-error">
<input type="hidden" name="options[entryId]" value="{{ $.Scratch.Get "post_parent" }}">
<input type="hidden" name="options[slug]" value="{{ .Permalink }}">
<input type="hidden" name="options[origin]" value="{{ .Permalink }}">
<input type="hidden" name="options[parent]" value="{{ $.Scratch.Get "post_parent" }}">
<input type="hidden" name="fields[reply_to]" value="">
<input type="hidden" name="options[reCaptcha][siteKey]" value="{{ .Site.Params.recaptcha_siteKey }}">
<input type="hidden" name="options[reCaptcha][secret]" value="{{ .Site.Params.recaptcha_secret }}">
<fieldset>
<input name="fields[name]" type="text" class="post-comment-field" placeholder="{{ i18n "yourName" }}">
</fieldset>
<fieldset>
<input name="fields[email]" type="email" class="post-comment-field" placeholder="{{ i18n "yourEmail" }}">
</fieldset>
<fieldset>
<textarea name="fields[body]" class="post-comment-field" placeholder="{{ i18n "useMarkdown" }}" rows="10"></textarea>
</fieldset>
<fieldset>
<div class="notify-me">
<input type="checkbox" id="comment-form-reply" name="options[subscribe]" value="email">
Send me an email when someone comments on this post.
</div>
</fieldset>
<fieldset>
<div class="g-recaptcha" data-sitekey="{{ .Site.Params.recaptcha_siteKey }}" data-callback="enableBtn"></div>
<input type="submit" class="post-comment-field btn" value="Submit" id="submit_button">
</fieldset>
</form>
<script async src='https://www.google.com/recaptcha/api.js' ></script>
<script type="text/javascript">
document.getElementById("submit_button").disabled = true;
</script>
<script type="text/javascript">
function enableBtn(){
document.getElementById("submit_button").disabled = false;
}
</script>
<div id="post-submitted" class="dialog">
<h3>Thank you</h3>
<p>Your post has been submitted and will be published once it has been approved.</p>
{{ if (.Site.Params.githubPullURL) }}
<p><a href="{{ .Site.Params.githubPullURL }}">Click here</a> to see the pull request you generated.</p>
{{ end }}
<p><a href="#" class="btn">OK</a></p>
</div>
<div id="post-error" class="dialog">
<h3>OOPS!</h3>
<p>Your post has not been submitted. Please return to the page and try again. Thank You!</p>
<p><a href="#" class="btn">OK</a></p>
</div>
</section>