mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-13 00:14:05 +00:00
feat(widget): add Compact view to Portfolio + refactor Portfolio
Also:
- Refactor List view to be consistent with the standard List views.
- This involved adding support for Project type and external links to
the standard
- Now, Portfolio's List and Compact views are just wrappers around the
standard List and Compact views.
- Fix summary in Showcase view not falling back to use Content.
Fix #1165
This commit is contained in:
1 parent
5a2a2f3e20
commit
026bb47c72
9 files changed
+77
-31
No files matched your search
@@ -39,6 +39,7 @@ subtitle = ""
|
||||
|
||||
# Toggle between the various page layout types.
|
||||
# 1 = List
|
||||
# 2 = Compact
|
||||
# 3 = Card
|
||||
# 5 = Showcase
|
||||
view = 3
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
{{ $microdata_type := "CreativeWork" }}
|
||||
{{ $show_authors_only := false }}{{/* Show authors only or full metadata? */}}
|
||||
{{ $show_buttons := false }}
|
||||
{{ $link := $item.RelPermalink }}
|
||||
{{ $target := "" }}
|
||||
{{ if $item.Params.external_link }}
|
||||
{{ $link = $item.Params.external_link }}
|
||||
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Dynamic view adjusts to content type. */}}
|
||||
{{ if eq $item.Type "post" }}
|
||||
@@ -15,6 +21,10 @@
|
||||
{{ $microdata_type = "ScholarlyArticle" }}
|
||||
{{ $show_authors_only = true }}
|
||||
{{ $show_buttons = true }}
|
||||
{{ else if eq $item.Type "project" }}
|
||||
{{ $microdata_type = "CreativeWork" }}
|
||||
{{ $show_authors_only = true }}
|
||||
{{ $show_buttons = true }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Get summary. */}}
|
||||
@@ -31,7 +41,7 @@
|
||||
<div class="media-body">
|
||||
|
||||
<h3 class="article-title mb-0 mt-0" itemprop="name">
|
||||
<a href="{{ $item.RelPermalink }}" itemprop="url">{{ $item.Title }}</a>
|
||||
<a href="{{$link}}" {{ $target | safeHTMLAttr }} itemprop="url">{{ $item.Title }}</a>
|
||||
</h3>
|
||||
|
||||
{{ with $summary }}
|
||||
@@ -74,7 +84,7 @@
|
||||
{{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
|
||||
{{ with $resource }}
|
||||
{{ $image := .Resize "150x" }}
|
||||
<a href="{{ $item.RelPermalink }}">
|
||||
<a href="{{$link}}" {{ $target | safeHTMLAttr }}>
|
||||
<img src="{{ $image.RelPermalink }}" itemprop="image">
|
||||
</a>
|
||||
{{end}}
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
{{ $item := . }}
|
||||
|
||||
{{ $microdata_type := "CreativeWork" }}
|
||||
{{ $icon_pack := "far" }}
|
||||
{{ $icon := "fa-file-alt" }}
|
||||
{{ $show_authors := false }}
|
||||
{{ $show_buttons := false }}
|
||||
{{ $link := $item.RelPermalink }}
|
||||
{{ $target := "" }}
|
||||
{{ if $item.Params.external_link }}
|
||||
{{ $link = $item.Params.external_link }}
|
||||
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Dynamic view adjusts to content type. */}}
|
||||
{{ if eq $item.Type "post" }}
|
||||
@@ -16,11 +23,17 @@
|
||||
{{ $microdata_type = "ScholarlyArticle" }}
|
||||
{{ $show_authors = true }}
|
||||
{{ $show_buttons = true }}
|
||||
{{ else if eq $item.Type "project" }}
|
||||
{{ $microdata_type = "CreativeWork" }}
|
||||
{{ $icon_pack = "fas" }}
|
||||
{{ $icon = "fa-project-diagram" }}
|
||||
{{ $show_authors = true }}
|
||||
{{ $show_buttons = true }}
|
||||
{{ end }}
|
||||
|
||||
<div class="view-list-item" itemscope itemtype="http://schema.org/{{$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>
|
||||
<i class="{{$icon_pack}} {{$icon}} pub-icon" aria-hidden="true"></i>
|
||||
<a href="{{$link}}" {{ $target | safeHTMLAttr }} itemprop="url"><span itemprop="name">{{ $item.Title }}</span></a>
|
||||
|
||||
{{ if eq $item.Type "talk" }}
|
||||
<div class="article-metadata">
|
||||
|
||||
@@ -4,6 +4,18 @@
|
||||
{{ $link := .link }}
|
||||
{{ $target := .target }}
|
||||
|
||||
{{/* Get summary. */}}
|
||||
{{ $summary := "" }}
|
||||
{{ if $item.Params.summary }}
|
||||
{{ $summary = $item.Params.summary | markdownify | emojify }}
|
||||
{{ else if .Params.abstract }}
|
||||
{{ $summary = .Params.abstract | markdownify | emojify }}
|
||||
{{ else if $item.Truncated }}
|
||||
{{ $summary = $item.Summary }}
|
||||
{{ else }}
|
||||
{{ $summary = $item.Content }}
|
||||
{{ end }}
|
||||
|
||||
{{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
|
||||
{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }}
|
||||
|
||||
@@ -17,9 +29,11 @@
|
||||
{{ end }}
|
||||
<div class="card-text">
|
||||
<h4><a href="{{ $link }}" {{ $target | safeHTMLAttr }}>{{ $item.Title | markdownify | emojify }}</a></h4>
|
||||
<div class="card-desription">
|
||||
{{ with $item.Params.summary }}<p>{{ . | markdownify | emojify }}</p>{{ end }}
|
||||
{{ with $summary }}
|
||||
<div class="article-style">
|
||||
{{ . | truncate 135 }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
{{ $item := .item }}
|
||||
{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }}
|
||||
|
||||
<div class="col-12 isotope-item {{ $js_tag_classes | safeHTMLAttr }}">
|
||||
{{ partial "li_compact" $item }}
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
{{ $item := .item }}
|
||||
{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }}
|
||||
|
||||
<div class="col-12 isotope-item {{ $js_tag_classes | safeHTMLAttr }}">
|
||||
{{ partial "li_list" $item }}
|
||||
</div>
|
||||
+13
-7
@@ -11,6 +11,18 @@
|
||||
{{ $link := .link }}
|
||||
{{ $target := .target }}
|
||||
|
||||
{{/* Get summary. */}}
|
||||
{{ $summary := "" }}
|
||||
{{ if $item.Params.summary }}
|
||||
{{ $summary = $item.Params.summary | markdownify | emojify }}
|
||||
{{ else if .Params.abstract }}
|
||||
{{ $summary = .Params.abstract | markdownify | emojify }}
|
||||
{{ else if $item.Truncated }}
|
||||
{{ $summary = $item.Summary }}
|
||||
{{ else }}
|
||||
{{ $summary = $item.Content }}
|
||||
{{ end }}
|
||||
|
||||
{{ $order := "" }}
|
||||
{{ if and ($widget.Params.design.flip_alt_rows | default true) (not (modBool .index 2)) }}
|
||||
{{ $order = "order-md-2" }}
|
||||
@@ -27,15 +39,9 @@
|
||||
{{- if $do_link}}</a>{{end -}}
|
||||
</h3>
|
||||
|
||||
{{ $summary := "" }}
|
||||
{{ if $item.Params.summary }}
|
||||
{{ $summary = $item.Params.summary }}
|
||||
{{ else if $item.Truncated }}
|
||||
{{ $summary = $item.Summary }}
|
||||
{{ end }}
|
||||
{{ with $summary }}
|
||||
<div class="article-style" itemprop="articleBody">
|
||||
{{ . | markdownify | emojify }}
|
||||
{{ . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{{ $item := .item }}
|
||||
{{ $widget := .widget }}
|
||||
{{ $link := .link }}
|
||||
{{ $target := .target }}
|
||||
{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }}
|
||||
|
||||
<div class="col-lg-12 project-item isotope-item {{ $js_tag_classes | safeHTMLAttr }}" itemscope itemtype="http://schema.org/CreativeWork">
|
||||
<i class="far fa-copy pub-icon" aria-hidden="true"></i>
|
||||
|
||||
<span class="project-title">
|
||||
<a href="{{ $link }}" {{ $target | safeHTMLAttr }} itemprop="url">{{ $item.Title | markdownify | emojify }}</a>
|
||||
</span>
|
||||
|
||||
{{ with $item.Params.summary }}<p class="project-summary">{{ . | markdownify | emojify }}</p>{{ end }}
|
||||
</div>
|
||||
@@ -68,19 +68,24 @@
|
||||
|
||||
<div class="{{ if or $st.Params.content.filter_button (eq $st.Params.design.view 3) }}isotope projects-container{{end}} {{if eq $st.Params.design.view 3}}js-layout-masonry{{else}}row js-layout-row{{end}} {{ if eq $st.Params.design.view 5 }}project-showcase mt-5{{end}}">
|
||||
{{ range $idx, $item := where site.RegularPages "Type" $items_type }}
|
||||
|
||||
{{ $link := $item.RelPermalink }}
|
||||
{{ $target := "" }}
|
||||
{{ if $item.Params.external_link }}
|
||||
{{ $link = $item.Params.external_link }}
|
||||
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $st.Params.design.view 1 }}
|
||||
{{ partial "project_li_list" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }}
|
||||
{{ partial "portfolio_li_list" (dict "item" $item) }}
|
||||
{{ else if eq $st.Params.design.view 2 }}
|
||||
{{ partial "portfolio_li_compact" (dict "item" $item) }}
|
||||
{{ else if eq $st.Params.design.view 3 }}
|
||||
{{ partial "project_li_card" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }}
|
||||
{{ partial "portfolio_li_card" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }}
|
||||
{{ else }}
|
||||
{{ partial "project_li_showcase" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }}
|
||||
{{ partial "portfolio_li_showcase" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user