refactor: consolidate list views

This commit is contained in:
George Cushen committed 2019-02-07 13:50:11 +00:00
1 parent 8a3f75839a
commit 7eb10f2b26
14 files changed
+85 -56

No files matched your search

+22 -10
View File
@@ -1096,15 +1096,35 @@ article .article-metadata {
}
/*************************************************
* Publications
* List items
**************************************************/
.view-list-item {
margin-bottom: 1rem;
}
.pub-icon {
color: rgba(0, 0, 0, 0.54);
font-size: 0.81em;
padding-top: 6px;
padding-right: 6px;
}
.view-list-item .article-metadata {
margin-bottom: 0;
}
.pub-list-item .pub-abstract {
font-size: 1rem;
}
.pub-list-item .btn-links {
padding-top: 10px;
}
/*************************************************
* Publications
**************************************************/
.pub-banner {
max-width: 100%;
height: auto;
@@ -1116,14 +1136,6 @@ article .article-metadata {
font-weight: bold;
}
.pub-list-item .pub-abstract {
font-size: 1rem;
}
.pub-list-item .btn-links {
padding-top: 10px;
}
#container-publications {
display: block;
position: relative;
+52
View File
@@ -0,0 +1,52 @@
{{ $item := . }}
{{ $microdata_type := "http://schema.org/CreativeWork" }}
{{ $icon := "fa-file-alt" }}
{{ $show_authors := false }}
{{ $show_buttons := false }}
{{/* Dynamic view adjusts to content type. */}}
{{ if eq $item.Type "post" }}
{{ $microdata_type = "http://schema.org/BlogPosting" }}
{{ $icon = "fa-newspaper" }}
{{ else if eq $item.Type "talk" }}
{{ $microdata_type = "http://schema.org/Event" }}
{{ $icon = "fa-calendar-alt" }}
{{ else if eq $item.Type "publication" }}
{{ $show_authors = true }}
{{ $show_buttons = true }}
{{ end }}
<div class="view-list-item" itemscope itemtype="{{$microdata_type}}">
<i class="far {{$icon}} pub-icon" aria-hidden="true"></i>
<a href="{{ $item.RelPermalink }}" itemprop="url"><span itemprop="name">{{ $item.Title }}</span></a>
{{ if eq $item.Type "talk" }}
<div class="article-metadata">
<span itemprop="startDate">
{{ $date := $item.Params.time_start | default $item.Date }}
{{ (time $date).Format $.Site.Params.date_format }}
{{ if not $item.Params.all_day }}
{{ (time $date).Format ($.Site.Params.time_format | default "3:04 PM") }}
{{ end }}
</span>
{{ with $item.Params.location }}
<span class="middot-divider"></span>
<span itemprop="location">{{ . }}</span>
{{ end }}
</div>
{{ end }}
{{ if $show_authors }}
<div class="article-metadata" itemprop="author">
{{ partial "page_metadata_authors" $item }}
</div>
{{ end }}
{{ if $show_buttons }}
<div class="btn-links">
{{ partial "page_links" (dict "content" $item "is_list" 1) }}
</div>
{{ end }}
</div>
-6
View File
@@ -1,6 +0,0 @@
{{ $post := . }}
<div class="pub-list-item" itemscope itemprop="blogPost" itemtype="http://schema.org/BlogPosting">
<i class="far fa-newspaper pub-icon" aria-hidden="true"></i>
<a href="{{ $post.RelPermalink }}" itemprop="url"><span itemprop="headline">{{ $post.Title }}</span></a>
</div>
@@ -1,8 +0,0 @@
<div class="pub-list-item" style="margin-bottom: 1rem" itemscope itemtype="http://schema.org/CreativeWork">
<i class="far fa-file-alt pub-icon" aria-hidden="true"></i>
<a href="{{ .RelPermalink }}" itemprop="name">{{ .Title }}</a>
<div itemprop="author">
{{ partial "page_metadata_authors" . }}
</div>
<p>{{ partial "page_links" (dict "content" . "is_list" 1) }}</p>
</div>
-21
View File
@@ -1,21 +0,0 @@
<div class="pub-list-item" style="margin-bottom: 1rem" itemscope itemtype="http://schema.org/Event">
<i class="fas fa-calendar-alt pub-icon" aria-hidden="true"></i>
<span itemprop="name"><a href="{{ .RelPermalink }}">{{ .Title }}</a></span>
<div itemprop="startDate">
{{ $date := .Params.time_start | default .Date }}
{{ (time $date).Format $.Site.Params.date_format }}
{{ if not .Params.all_day }}
{{ (time $date).Format ($.Site.Params.time_format | default "3:04 PM") }}
{{ end }}
</div>
<div class="talk-metadata">
{{ if .Params.event_short }}
{{ .Params.event_short | markdownify }}
{{ else if .Params.event }}
{{ .Params.event | markdownify }}
{{ end }}
</div>
<div class="btn-links">
{{ partial "page_links" (dict "content" . "is_list" 1) }}
</div>
</div>
+1 -1
View File
@@ -27,7 +27,7 @@
{{ range $post := first $page.Params.count $query }}
{{ if eq $page.Params.view 1 }}
{{ partial "post_li_list" . }}
{{ partial "li_list" . }}
{{ else if eq $page.Params.view 3 }}
{{ partial "post_li_card" . }}
{{ else }}
+1 -1
View File
@@ -22,7 +22,7 @@
{{ range first $page.Params.count $query }}
{{ if eq $page.Params.view 1 }}
{{ partial "publication_li_list" . }}
{{ partial "li_list" . }}
{{ else if eq $page.Params.view 3 }}
{{ partial "publication_li_card" . }}
{{ else if eq $page.Params.view 4 }}
@@ -19,7 +19,7 @@
{{ $sel_pubs := $.Scratch.Get "sel_pubs" }}
{{ range $sel_pubs }}
{{ if eq $page.Params.view 1 }}
{{ partial "publication_li_list" . }}
{{ partial "li_list" . }}
{{ else if eq $page.Params.view 3 }}
{{ partial "publication_li_card" . }}
{{ else if eq $page.Params.view 4 }}
+1 -1
View File
@@ -20,7 +20,7 @@
{{ range first $page.Params.count (sort $talks ".Params.time_start" "desc") }}
{{ if eq $page.Params.view 1 }}
{{ partial "talk_li_list" . }}
{{ partial "li_list" . }}
{{ else if eq $page.Params.view 3 }}
{{ partial "talk_li_card" . }}
{{ else }}
+1 -1
View File
@@ -12,7 +12,7 @@
{{ range (sort (where (where $.Site.RegularPages "Type" "talk") ".Params.featured" true) ".Params.time_start" "desc") }}
{{ if eq $page.Params.view 1 }}
{{ partial "talk_li_list" . }}
{{ partial "li_list" . }}
{{ else if eq $page.Params.view 3 }}
{{ partial "talk_li_card" . }}
{{ else }}
+3 -3
View File
@@ -23,7 +23,7 @@
<h2>{{ (i18n "posts") }}</h2>
{{ range $items }}
{{ if eq $page.Site.Params.projects.post_format 1 }}
{{ partial "post_li_list" . }}
{{ partial "li_list" . }}
{{ else if eq $page.Site.Params.projects.post_format 3 }}
{{ partial "post_li_card" . }}
{{ else }}
@@ -38,7 +38,7 @@
<h2>{{ (i18n "publications") }}</h2>
{{ range $items }}
{{ if eq $page.Site.Params.projects.publication_format 1 }}
{{ partial "publication_li_list" . }}
{{ partial "li_list" . }}
{{ else if eq $page.Site.Params.projects.publication_format 3 }}
{{ partial "publication_li_card" . }}
{{ else if eq $page.Site.Params.projects.publication_format 4 }}
@@ -55,7 +55,7 @@
<h2>{{ (i18n "talks") }}</h2>
{{ range sort $items ".Params.time_start" "desc" }}
{{ if eq $page.Site.Params.projects.talk_format 1 }}
{{ partial "talk_li_list" . }}
{{ partial "li_list" . }}
{{ else if eq $page.Site.Params.projects.talk_format 3 }}
{{ partial "talk_li_card" . }}
{{ else }}
+1 -1
View File
@@ -12,7 +12,7 @@
{{ $paginator := .Paginate .Data.Pages }}
{{ range $paginator.Pages }}
{{ if eq $.Params.view 1 }}
{{ partial "post_li_list" . }}
{{ partial "li_list" . }}
{{ else if eq $.Params.view 3 }}
{{ partial "post_li_card" . }}
{{ else }}
+1 -1
View File
@@ -59,7 +59,7 @@
<div class="grid-sizer col-lg-12 isotope-item pubtype-{{ $.Scratch.Get "pubtype" }} year-{{ .Date.Format "2006" }}">
{{ if eq $.Params.view 1 }}
{{ partial "publication_li_list" . }}
{{ partial "li_list" . }}
{{ else if eq $.Params.view 3 }}
{{ partial "publication_li_card" . }}
{{ else if eq $.Params.view 4 }}
+1 -1
View File
@@ -20,7 +20,7 @@
{{ range sort .Pages ".Params.time_start" "desc" }}
{{ if eq $.Params.view 1 }}
{{ partial "talk_li_list" . }}
{{ partial "li_list" . }}
{{ else if eq $.Params.view 3 }}
{{ partial "talk_li_card" . }}
{{ else }}