Blog posts are useable

This commit is contained in:
Asaf Gartner 2024-07-02 13:20:05 +03:00
parent b11114b002
commit bab955aaff
2 changed files with 125 additions and 122 deletions

View File

@ -1,128 +1,131 @@
{{ template "base.html" . }} {{ template "base-2024.html" . }}
{{ define "content" }} {{ define "content" }}
<div class="mw7 m-center tl post ph3 ph0-ns"> <div class="flex justify-center pa3">
<h1>{{ .Thread.Title }}</h1> <div class="mw-site post-content flex flex-column g2">
{{ with .MainPost }} <div>
<div class="flex justify-between items-center mt2 mb3"> <h1>{{ .Thread.Title }}</h1>
<div class="flex items-center"> {{ with .MainPost }}
<div class="avatar contain bg-center" style="background-image:url('{{ .Author.AvatarUrl }}');"></div> <div class="flex justify-between items-center mt2 mb3">
<div class="flex flex-column ml2"> <div class="flex items-center">
<div> <div class="avatar contain bg-center" style="background-image:url('{{ .Author.AvatarUrl }}');"></div>
<a class="username" href="{{ .Author.ProfileUrl }}" target="_blank">{{ .Author.Name }}</a> <div class="flex flex-column ml2">
<div class="di ph1"> <div>
{{ if .Author.IsStaff }} <a class="username" href="{{ .Author.ProfileUrl }}" target="_blank">{{ .Author.Name }}</a>
<div class="badge staff"></div> </div>
{{ end }} <div class="c--dim f7">{{ timehtml (absoluteshortdate .PostDate) .PostDate }}</div>
</div> </div>
</div> </div>
<div class="c--dim f7">{{ timehtml (absoluteshortdate .PostDate) .PostDate }}</div> <div class="di ph1">
</div> {{ if .Author.IsStaff }}
</div> <div class="badge staff"></div>
<div> {{ end }}
{{ if and $.User $.Project.HasBlog }} </div>
<div class="flex"> <div class="flex-grow-1"></div>
{{ if or (eq .Author.ID $.User.ID) $.User.IsStaff }} <div>
<a class="delete action button" href="{{ .DeleteUrl }}" title="Delete">&#10006;</a>&nbsp; {{ if and $.User $.Project.HasBlog }}
<a class="edit action button" href="{{ .EditUrl }}" title="Edit">&#9998;</a>&nbsp; <div class="flex">
{{ end }} {{ if or (eq .Author.ID $.User.ID) $.User.IsStaff }}
{{ if or (not $.Thread.Locked) $.User.IsStaff }} <a class="delete action button" href="{{ .DeleteUrl }}" title="Delete">&#10006;</a>&nbsp;
{{ if $.Thread.Locked }} <a class="edit action button" href="{{ .EditUrl }}" title="Edit">&#9998;</a>&nbsp;
WARNING: locked thread - use power responsibly! {{ end }}
{{ end }} {{ if or (not $.Thread.Locked) $.User.IsStaff }}
<a class="reply action button" href="{{ .ReplyUrl }}" title="Reply">&hookrightarrow;</a>&nbsp; {{ if $.Thread.Locked }}
{{ end }} WARNING: locked thread - use power responsibly!
</div> {{ end }}
{{ end }} <a class="reply action button" href="{{ .ReplyUrl }}" title="Reply">&hookrightarrow;</a>&nbsp;
</div> {{ end }}
</div> </div>
{{ end }} {{ end }}
</div>
</div>
{{ end }}
<!-- Main post --> <!-- Main post -->
<div class="{{ if .IsProjectPage }}mb3{{ end }}"> <div class="{{ if .IsProjectPage }}mb3{{ end }}">
<div class="post-content overflow-x-auto"> <div class="post-content overflow-x-auto">
{{ .MainPost.Content }} {{ .MainPost.Content }}
</div> </div>
</div> </div>
</div>
{{ if not .IsProjectPage }} {{ if not .IsProjectPage }}
{{ template "newsletter_signup.html" . }} {{ template "newsletter_signup.html" . }}
{{ end }} {{ end }}
<div class="optionbar"></div> <div class="bb ba1"></div>
{{ range .Comments }} {{ range .Comments }}
<div class="pa3 flex items-start background-even"> <div class="pa2 flex items-start background-even">
<div> <div>
<div class="avatar contain bg-center" style="background-image:url('{{ .Author.AvatarUrl }}');"></div> <div class="avatar contain bg-center" style="background-image:url('{{ .Author.AvatarUrl }}');"></div>
</div> </div>
<div class="pl3 flex flex-column w-100"> <div class="pl3 flex flex-column w-100">
<div class="flex justify-between"> <div class="flex justify-between">
<div> <div>
<div> <div>
<a class="username" href="{{ .Author.ProfileUrl }}" target="_blank">{{ .Author.Username }}</a> <a class="username" href="{{ .Author.ProfileUrl }}" target="_blank">{{ .Author.Name }}</a>
<div class="di ph1"> </div>
{{ if .Author.IsStaff }} <div class="c--dim f7">
<div class="badge staff"></div> {{ timehtml (relativedate .PostDate) .PostDate }}
{{ end }} {{ if .Editor }}
</div> <span class="pl3">
</div> Edited by
<div class="c--dim f7"> <a class="name" href="{{ .Editor.ProfileUrl }}" target="_blank">{{ coalesce .Editor.Name .Editor.Username }}</a>
{{ if and .Author.Name (ne .Author.Name .Author.Username) }} on {{ timehtml (absolutedate .EditDate) .EditDate }}
{{ .Author.Name }}, {{ with .EditReason }}
{{ end }} Reason: {{ . }}
{{ timehtml (relativedate .PostDate) .PostDate }} {{ end }}
{{ if .Editor }} </span>
<span class="pl3"> {{ end }}
Edited by </div>
<a class="name" href="{{ .Editor.ProfileUrl }}" target="_blank">{{ coalesce .Editor.Name .Editor.Username }}</a> </div>
on {{ timehtml (absolutedate .EditDate) .EditDate }} <div class="di ph1">
{{ with .EditReason }} {{ if .Author.IsStaff }}
Reason: {{ . }} <div class="badge staff"></div>
{{ end }} {{ end }}
</span> </div>
{{ end }} <div class="flex-grow-1"></div>
</div> <div>
</div> {{ if and $.User $.Project.HasBlog }}
<div> <div class="flex">
{{ if and $.User $.Project.HasBlog }} {{ if or (eq .Author.ID $.User.ID) $.User.IsStaff }}
<div class="flex"> <a class="delete action button" href="{{ .DeleteUrl }}" title="Delete">&#10006;</a>&nbsp;
{{ if or (eq .Author.ID $.User.ID) $.User.IsStaff }} <a class="edit action button" href="{{ .EditUrl }}" title="Edit">&#9998;</a>&nbsp;
<a class="delete action button" href="{{ .DeleteUrl }}" title="Delete">&#10006;</a>&nbsp; {{ end }}
<a class="edit action button" href="{{ .EditUrl }}" title="Edit">&#9998;</a>&nbsp; {{ if or (not $.Thread.Locked) $.User.IsStaff }}
{{ end }} {{ if $.Thread.Locked }}
{{ if or (not $.Thread.Locked) $.User.IsStaff }} WARNING: locked thread - use power responsibly!
{{ if $.Thread.Locked }} {{ end }}
WARNING: locked thread - use power responsibly! <a class="reply action button" href="{{ .ReplyUrl }}" title="Reply">&hookrightarrow;</a>&nbsp;
{{ end }} {{ end }}
<a class="reply action button" href="{{ .ReplyUrl }}" title="Reply">&hookrightarrow;</a>&nbsp; <span class="postid">
{{ end }} <a name="{{ .ID }}" href="{{ .Url }}">#{{ .ID }}</a>
<span class="postid"> </span>
<a name="{{ .ID }}" href="{{ .Url }}">#{{ .ID }}</a> </div>
</span> {{ end }}
</div> </div>
{{ end }} </div>
</div> <div class="w-100 pt3">
</div> <div class="post-content overflow-x-auto">
<div class="w-100 pt3"> {{ .Content }}
<div class="post-content overflow-x-auto"> </div>
{{ .Content }} </div>
</div> </div>
</div> </div>
</div> {{ end }}
</div>
{{ end }}
<div class="optionbar bottom"> <div class="bb ba1"></div>
<div class="options">
{{ if .Project.HasBlog }} <div>
{{ if $.User }} {{ if .Project.HasBlog }}
<a class="button" href="{{ .ReplyLink }}"><span class="big pr1">+</span> Add Comment</a> {{ if $.User }}
{{ else }} <a href="{{ .ReplyLink }}"><span class="big pr1">+</span> Add Comment</a>
<a class="button" href="{{ .LoginLink }}">Log in to comment</a> {{ else }}
{{ end }} <a href="{{ .LoginLink }}">Log in to comment</a>
{{ end }} {{ end }}
</div> {{ end }}
</div> </div>
</div>
</div> </div>
{{ end }} {{ end }}

View File

@ -1,9 +1,9 @@
<div class="pv3 flex flex-column g2 items-center"> <div class="hmn-form pv3 flex flex-column g2 items-center">
<form id="newsletter-form" class="flex flex-column items-center"> <form id="newsletter-form" class="flex flex-column items-center">
<div class="b pv2">Sign up for our email newsletter:</div> <div class="b pv2">Sign up for our email newsletter:</div>
<div class="flex g2 justify-center"> <div class="flex g2 justify-center">
<input id="newsletter-email" type="email" class="input--jam flex-grow-1 flex-grow-0-ns" placeholder="me@example.com"> <input id="newsletter-email" type="email" class="input--jam flex-grow-1 flex-grow-0-ns" placeholder="me@example.com">
<button id="newsletter-button" class="white">Sign up</button> <button id="newsletter-button" class="btn-primary white">Sign up</button>
</div> </div>
<div id="newsletter-message" class="f7 pt1"> <div id="newsletter-message" class="f7 pt1">
&nbsp; &nbsp;
@ -43,4 +43,4 @@
button.disabled = false; button.disabled = false;
}); });
} }
</script> </script>