Files
HugoBlox-kit/layouts/partials/widgets/projects.html
T
George Cushen de269ebdb8 feat(project): add showcase mode and revert card view to resized images
* add project showcase layout, set `view = 2` in `projects.md` to use
* revert card view to use resized images rather than cropped images
* fix project filters for tags with non-ASCII (i18n) characters
* add single column wide layout for project widget, to use set
  `widget_layout` in `projects.md`
* add `flip_alt_rows` widget option to flip alternate rows in showcase
  mode
* `url_` link buttons can now be added for projects
* all link buttons now appear in page header rather than under a 'links'
  section within the page
* Markdown slides can now be linked from any page by using new `slides`
  option
* Isotope JS is now only activated when required (i.e. when using card
  view or when filters are defined)
* `links` translation removed from i18n
* consolidate talk, pub., and new project links files into new single
  `page_links.html` for all pages
* move project widget layouts to their own files

Close #764
Close #785
Close #776
Close #645
Close #326

BREAKING CHANGE:

CSS class names of project tags are now prefixed with `js-id-` to
namespace them and prevent clashes with existing CSS classes.

Migrate any filter `tag`s in `projects.md` that are prefixed `.` to the
new `.js-id-` prefix.
2018-11-03 20:13:43 +00:00

86 lines
3.5 KiB
HTML

{{ $ := .root }}
{{ $page := .page }}
<!-- Projects widget -->
{{ $widget_layout := $page.Params.widget_layout | default 0 }}
{{ if eq $widget_layout 0 }}
{{/* Standard dual-column layout. */}}
<div class="row">
<div class="col-xs-12 col-md-4 section-heading">
<h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
</div>
<div class="col-xs-12 col-md-8">
{{ else }}
{{/* Single column layout. */}}
<div class="margin-auto">
<div class="center-text">
{{ with $page.Title }}<h1 class="mt-0">{{ . | markdownify }}</h1>{{ end }}
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
</div>
<div>
{{ end }}
{{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
{{ if $page.Params.filter }}
{{ $filter_default := default (int $page.Params.filter_default) 0 }}
{{/* Parse default filter tag from front matter in the form of either tag name or CSS class name. */}}
{{ $default_filter_tag_raw := (index $page.Params.filter ($filter_default)).tag }}
{{ $default_filter_tag := printf ".js-id-%s" (replace $default_filter_tag_raw " " "-") }}
{{ if or (eq (substr $default_filter_tag_raw 0 1) "*") (eq (substr $default_filter_tag_raw 0 1) ".") }}
{{ $default_filter_tag = $default_filter_tag_raw }}
{{ end }}
<span class="d-none default-project-filter">{{ $default_filter_tag }}</span>
{{/* Only show filter buttons if there are multiple filters. */}}
{{ if gt (len $page.Params.filter) 1 }}
<div class="project-toolbar">
<div class="project-filters">
<div class="btn-toolbar">
<div class="btn-group flex-wrap">
{{ range $idx, $item := $page.Params.filter }}
{{/* Parse filter tag from front matter in the form of either tag name or CSS class name. */}}
{{ $data_filter := printf ".js-id-%s" (replace .tag " " "-") }}
{{ if or (eq (substr .tag 0 1) "*") (eq (substr .tag 0 1) ".") }}
{{ $data_filter = .tag }}
{{ end }}
<a href="#" data-filter="{{ $data_filter | safeHTMLAttr }}" class="btn btn-primary btn-lg{{ if eq $idx $filter_default }} active{{ end }}">{{ .name }}</a>
{{ end }}
</div>
</div>
</div>
</div>
{{ end }}
{{ end }}
<div class="row {{ if or $page.Params.filter (eq $page.Params.view 1) }}isotope projects-container{{end}} {{if eq $page.Params.view 1}}js-layout-masonry{{else}}js-layout-row{{end}} {{ if eq $page.Params.view 2 }}project-showcase mt-5{{end}}">
{{ range $idx, $item := where $.Site.RegularPages "Type" ($page.Params.folder | default "project") }}
{{ $link := $item.RelPermalink }}
{{ $target := "" }}
{{ if $item.Params.external_link }}
{{ $link = $item.Params.external_link }}
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
{{ end }}
{{ if eq $page.Params.view 0 }}
{{ partial "project_li_simple" (dict "widget" $page "index" $idx "item" $item "link" $link "target" $target) }}
{{ else if eq $page.Params.view 1 }}
{{ partial "project_li_card" (dict "widget" $page "index" $idx "item" $item "link" $link "target" $target) }}
{{ else }}
{{ partial "project_li_showcase" (dict "widget" $page "index" $idx "item" $item "link" $link "target" $target) }}
{{ end }}
{{ end }}
</div>
</div>
</div>