revise styles for displaying draft posts

This commit is contained in:
Huy Tran 2018-11-27 21:17:45 +11:00
parent 77613eb5ce
commit 9cd5abf95b
3 changed files with 16 additions and 5 deletions

View file

@ -10,7 +10,7 @@
color: #333; color: #333;
border-radius: 2px; border-radius: 2px;
padding: 1px 5px; padding: 1px 5px;
} }
.text-center { .text-center {
text-align: center; text-align: center;
@ -19,3 +19,7 @@
.pull-right { .pull-right {
float: right; float: right;
} }
.draft {
color: #999 !important;
}

View file

@ -6,23 +6,30 @@
<div class="post-list"> <div class="post-list">
{{ $paginator := .Paginate (where .Data.Pages "Type" "posts") }} {{ $paginator := .Paginate (where .Data.Pages "Type" "posts") }}
{{ range $paginator.Pages }} {{ range $paginator.Pages }}
{{ if .Draft }}
{{ .Scratch.Set "draftPage" true }}
{{ else }}
{{ .Scratch.Set "draftPage" false }}
{{ end }}
<div class="post-list__item"> <div class="post-list__item">
<span class="item__title--big"> <span class="item__title--big">
<a href="{{ .RelPermalink }}">{{ .Title }}</a> <a href="{{ .RelPermalink }}" {{if .Scratch.Get "draftPage" }}class="draft"{{end}}>{{ .Title }}</a>
{{ if .Draft }}<sup><i class="fas fa-comment-dots fa-xs"></i></sup>{{ end }}
</span> </span>
<span class="item__date"> <span class="item__date">
{{ .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") }} {{ .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") }}
</span> </span>
<span {{if .Scratch.Get "draftPage" }}class="draft"{{end}}>
{{ if .Description }} {{ if .Description }}
{{ .Description }} {{ .Description }}
{{ else }} {{ else }}
{{ .Summary }} {{ .Summary }}
{{ end }} {{ end }}
</span>
{{ if .Truncated }} {{ if .Truncated }}
... <a class="read-more-symbol" href="{{ .RelPermalink }}"></a> ... <a class="read-more-symbol" href="{{ .RelPermalink }}"></a>
{{ end }} {{ end }}
</div> </div>
{{ .Scratch.Delete "draftPage" }}
{{ end }} {{ end }}
</div> </div>
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}

View file

@ -1,10 +1,10 @@
{{ range . }} {{ range . }}
<li> <li>
<span class="list__title--small"> <span class="list__title--small">
<a href="{{ .RelPermalink }}">{{ .Title }}</a> <a href="{{ .RelPermalink }}" {{if .Draft}}class="draft"{{end}}>{{ .Title }}</a>
{{if not .Date.IsZero}} {{if not .Date.IsZero}}
<time class="pull-right hidden-tablet">{{.Date.Format ("Jan 02 '06")}}</time> <time class="pull-right hidden-tablet">{{.Date.Format ("Jan 02 '06")}}</time>
{{end}} {{end}}
</span> </span>
</li> </li>
{{ end }} {{ end }}