hugo-theme-introduction/layouts/partials/projects.html
2018-06-25 15:03:18 +02:00

71 lines
3.3 KiB
HTML

{{ with .Site.GetPage "section" "projects" }}
<div class="section" id="projects">
<!-- Begin Projects container -->
<div class="container">
<h2 class="title is-2 has-text-centered">{{ .Title }}</h2>
<div class="section is-small">
<div class="columns is-multiline">
{{ range sort .Pages }}
{{ if eq .Site.Params.projectColumns "2" }}
<div class="column is-half"> {{ else if eq .Site.Params.projectColumns "3" }}
<div class="column is-one-third"> {{ else }}
<div class="column is-one-third"> {{ end }}
<!-- Hey Vicky, show half column if number is even. -->
<div {{ if not .Params.external_link }} id="project{{ $card := .Title | urlize }}{{ replace $card "%" ""}}" {{ end }} class="card">
<div class="card-image">
<figure class="image is-3by2">
<a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
<img src="{{ if .Params.image }}{{ .Params.image | relURL }}{{ else }}{{ (.Site.Params.placeHolderimg | default "/img/workday.jpg") | relURL }}{{ end }}">
</a>
</figure>
</div>
<div class="card-content has-text-centered top-pad">
<a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
{{ .Title }}
</a>
</div>
</div>
</div>
{{ end }}
</div>
</div>
</div>
<!-- End Projects container -->
<!-- Projects modals -->
{{ range sort .Pages }}
{{ if not .Params.external_link }}
<div class="modal" id="modal{{ $card := .Title | urlize }}{{ replace $card "%" ""}}">
<div class="modal-background"></div>
<div class="modal-card">
{{ with .Title }}
<header class="modal-card-header bottom-pad">
<p class="modal-card-title has-text-centered">{{ . }}</p>
</header>
{{ end }}
{{ if .Params.image }}
<img src="{{ .Params.image | relURL }}" class="img-responsive img-centered">
{{ end }}
{{ if .Content }}
<section class="modal-card-body markdown">
{{ .Content }}
</section>
{{ end }}
</div>
<button class="modal-close is-large" aria-label="close" id="close{{ $card := .Title | urlize }}{{ replace $card "%" ""}}"></button>
</div>
<script>
$('#project{{ $card := .Title | urlize }}{{ replace $card "%" ""}}').click(function() {
$('#modal{{ $card := .Title | urlize }}{{ replace $card "%" ""}}').addClass('is-active');
});
$('#close{{ $card := .Title | urlize }}{{ replace $card "%" ""}}').click(function() {
$('#modal{{ $card := .Title | urlize }}{{ replace $card "%" ""}}').removeClass('is-active');
});
</script>
{{ end }} {{ end }}
{{ partial "top-icon.html" . }}
</div>
<!-- End Projects section -->
<div class="container"><hr></div>
{{ end }}