hugo-theme-introduction/layouts/partials/home/projects.html

101 lines
4.5 KiB
HTML
Raw Normal View History

{{ with .Site.GetPage "/projects" }}
2018-06-27 09:30:11 +00:00
<div class="section" id="{{ .Title | urlize }}">
2017-11-13 21:01:53 +00:00
<!-- Begin Projects container -->
2018-06-25 13:03:18 +00:00
<div class="container">
2018-06-26 22:30:17 +00:00
<h2 class="title is-2 has-text-centered">
2020-05-31 18:12:41 +00:00
{{ .Title | markdownify }}
2018-06-26 22:30:17 +00:00
</h2>
2018-07-22 05:24:01 +00:00
<div class="section">
2018-06-25 13:03:18 +00:00
<div class="columns is-multiline">
2018-06-27 00:33:38 +00:00
{{ $totalProjects := (len .Pages) }}
2018-07-21 07:53:23 +00:00
{{ $numberOfProjectsToShow := .Site.Params.home.numberOfProjectsToShow | default $totalProjects }}
2018-06-27 09:37:23 +00:00
{{ range $index, $element := .Pages.ByWeight | first $numberOfProjectsToShow }}
2018-08-30 20:06:12 +00:00
{{ $width := "302x" }}
{{ $columWidth := "is-one-third" }}
2018-07-22 05:24:01 +00:00
{{ if .Site.Params.projects.useTwoColumns }}
2018-08-30 20:06:12 +00:00
{{ $columWidth = "is-half" }}
{{ $width = "490x" }}
{{ end}}
<div class="column {{ $columWidth }}">
2018-07-01 11:08:26 +00:00
<div class="card" data-target="#project-{{ $index }}">
{{ if .Resources.ByType "image" }}
2018-06-27 09:22:46 +00:00
<div class="card-image">
<figure class="image is-3by2">
2018-01-28 19:49:28 +00:00
<a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
2018-07-06 12:27:34 +00:00
{{ with .Resources.ByType "image" }}
{{ range first 1 (sort . "Params.weight") }}
2018-07-21 08:32:38 +00:00
{{ $image := .Resize $width }}
<img class="card-thumbnail" src="{{ $image.Permalink }}" alt ="{{ $image.Name }}">
2018-07-06 12:27:34 +00:00
{{ end }}
{{ end }}
2017-11-13 21:01:53 +00:00
</a>
2018-06-27 09:22:46 +00:00
</figure>
</div>
{{ end }}
2018-06-27 09:22:46 +00:00
<div class="card-content has-text-centered top-pad">
<h1><a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
2020-05-31 18:12:41 +00:00
{{ .Title | markdownify }}
</a></h1>
{{ if .Params.project_timeframe }}
<p class="fa-xs">{{ .Params.project_timeframe }}</p>
{{ end }}
2017-11-13 21:01:53 +00:00
</div>
2018-06-25 13:03:18 +00:00
</div>
2017-11-13 21:01:53 +00:00
</div>
2018-06-27 09:22:46 +00:00
{{ end }}
2017-11-13 21:01:53 +00:00
</div>
2018-06-25 13:03:18 +00:00
</div>
2018-06-26 22:30:17 +00:00
{{ if lt $numberOfProjectsToShow $totalProjects }}
<div class="container has-text-centered top-pad">
2018-07-20 15:27:32 +00:00
<a href="{{ .Permalink }}">{{ i18n "index_projects_allProjects" . }}</a>
2018-06-26 22:30:17 +00:00
</div>
{{ end }}
2018-06-25 13:03:18 +00:00
</div>
<!-- End Projects container -->
<!-- Projects modals -->
2018-07-01 08:09:29 +00:00
{{ range $index, $element := .Pages.ByWeight | first $numberOfProjectsToShow }}
{{ if not .Params.external_link }}
<div class="modal" id="project-{{ $index }}">
2018-06-25 13:03:18 +00:00
<div class="modal-background"></div>
<div class="modal-card">
{{ with .Title }}
<header class="modal-card-header bottom-pad">
<h1 class="modal-card-title has-text-centered">{{ . }}</h1>
2018-06-25 13:03:18 +00:00
</header>
{{ end }}
{{ if .Params.project_timeframe }}
<p class="fa-xs">{{ .Params.project_timeframe }}</p>
2021-07-24 13:49:01 +00:00
{{ end }}
<section class="modal-card-body markdown">
{{ with .Resources.ByType "image" }}
{{ $moreThenOneImage := gt (len .) 1 }}
{{ if $moreThenOneImage }}
<div class="owl-carousel owl-theme">
{{ end }}
{{ range sort . "Params.weight" }}
{{ $image := .Resize "640x" }}
{{ if $moreThenOneImage }}
<div class="item owl-height">
{{ end }}
<img src="{{ $image.Permalink }}" class="img-responsive" alt="{{ $image.Name }}">
{{ if $moreThenOneImage }}
</div>
{{ end }}
2018-07-19 13:33:29 +00:00
{{ end }}
2021-07-24 13:49:01 +00:00
{{ if $moreThenOneImage }}
</div>
2018-07-19 13:33:29 +00:00
{{ end }}
2021-07-24 13:49:01 +00:00
{{ end }}
{{ .Content }}
2018-06-25 13:03:18 +00:00
</section>
</div>
2018-07-01 11:08:26 +00:00
<button class="modal-close is-large" aria-label="close" data-target="#project-{{ $index }}"></button>
2017-03-13 09:14:02 +00:00
</div>
2018-07-01 08:09:29 +00:00
{{ end }}
{{ end }}
2018-06-25 13:03:18 +00:00
{{ partial "top-icon.html" . }}
2017-11-13 21:01:53 +00:00
</div>
2018-06-25 13:03:18 +00:00
<!-- End Projects section -->
<div class="container"><hr></div>
{{ end }}