diff options
author | Justin Berthault <justin.berthault@zaclys.net> | 2017-12-06 19:33:36 +0300 |
---|---|---|
committer | Justin Berthault <justin.berthault@zaclys.net> | 2017-12-06 19:33:36 +0300 |
commit | a466a10c80a8ee28c392cbdc2168b7916a740717 (patch) | |
tree | 9a0761e779b2279c24bd907785c2191303708afe | |
parent | b24a7dce4e2eccc991c9970d5db02bf432d54ac5 (diff) |
Static comments here we are
-rw-r--r-- | layouts/_default/single.html | 4 | ||||
-rw-r--r-- | layouts/partials/comments.html | 27 | ||||
-rw-r--r-- | layouts/partials/form.html | 12 | ||||
-rw-r--r-- | static/css/style.css | 28 |
4 files changed, 71 insertions, 0 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index e7bf222..457d7ef 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -56,6 +56,10 @@ {{ end }} </ul> {{ end }} + {{ if .Site.Params.static_comments }} + {{ partial "form" . }} + {{ partial "comments" . }} + {{ end }} {{ end }} {{- define "scripts" -}} {{- if isset .Params "lightbox" -}} diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html new file mode 100644 index 0000000..abd639b --- /dev/null +++ b/layouts/partials/comments.html @@ -0,0 +1,27 @@ +{{ with (index .Site.Data.comments (substr $.File.LogicalName 0 -3)) }} +<h3>Commentaires </h3> +<div class="comments"> +{{ range .comments }} +{{ if .id }} + <div class="comment"> + <span><strong>{{ .id }}</strong></span></br> + <div class="comment-name">{{ .name }}{{if .website}} - <a href="{{ .website | safeURL }}">{{ .website }}{{ end }}</a></div> + <div class="comment-date">{{ .date }}</div> + <div class="comment-body">{{ .body | markdownify }}</div> + {{if .reply}} + {{range .reply}} + <div class="reply"> + <span><strong>{{ .replyid }}</strong></span></br> + <div class="reply-name">{{ .replyname }}{{if .replywebsite}} - <a href="{{ .replywebsite | safeURL }}">{{ .replywebsite }}{{ end }}</a></div> + <div class="reply-date">{{ .replydate }}</div> + <div class="reply-body">{{ .replybody | markdownify }}</div> + </div> + {{ end }} + {{ end }} + </div> +{{ end }} +{{ end }} +</div> +{{ else }} +<h3>Pas de commentaires pour le moment</h3> +{{ end }} diff --git a/layouts/partials/form.html b/layouts/partials/form.html new file mode 100644 index 0000000..5fefe10 --- /dev/null +++ b/layouts/partials/form.html @@ -0,0 +1,12 @@ +<h3 class="comment-title">Poster un commentaire</h3> +<form method="POST" action="/comments/submit.php"> + <input type="hidden" name="post_id" value="{{ .URL }}" /> + <input type="hidden" name="return_url" value="{{ .URL }}" /> + <p>Nom : <input name="name" /></p> + <p>Email (optionel): <input name="email" /></p> + <p>Site Web (optionel): <input name="home" /></p> + <p>Quelle est la 3e lettre du mot <code>blog</code> ? <input type="text" name="antispam" size="1" maxlength="1" required/> + <p>Votre message : + <br /><textarea name="comment" rows="10" cols="50" required></textarea></p> + <p><input type="submit" value="Envoyer" /></p> +</form> diff --git a/static/css/style.css b/static/css/style.css index cc0aa58..f9715cc 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -194,6 +194,34 @@ img { border-radius: .25em; background-color: #5b9dd9; } +.comments { + padding: .4rem; +} +.comment { + background-color: #4c5767; + padding: .4rem; + border-radius: 4px; + margin-top: .4rem; +} +.reply { + background-color: #414b58; + padding: 0.4rem; + border-radius: 4px; + margin-top: .4rem; + margin-left: 1rem; +} +.comments span { + float: left; +} +.comment-name, .reply-name { + float: left; +} +.comment-date, .reply-date { + float: right; +} +.comment-body, .reply-body { + clear: both; +} @media only screen and (min-width: 900px) { aside { float: left; |