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

83 lines
3.5 KiB
HTML
Raw Normal View History

2018-06-25 13:03:18 +00:00
{{ with .Site.GetPage "section" "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">
{{ .Title }}
</h2>
2018-06-25 13:03:18 +00:00
<div class="section is-small">
<div class="columns is-multiline">
2018-06-27 00:33:38 +00:00
{{ $totalProjects := (len .Pages) }}
2018-06-26 22:30:17 +00:00
{{ $numberOfProjectsToShow := .Site.Params.numberOfProjectsToShow | default $totalProjects }}
2018-06-27 09:37:23 +00:00
{{ range $index, $element := .Pages.ByWeight | first $numberOfProjectsToShow }}
2018-06-26 22:30:17 +00:00
{{ if eq (mod $numberOfProjectsToShow 2) 0 }}
<div class="column is-half">
2018-06-27 09:22:46 +00:00
{{ else }}
<div class="column is-one-third">
{{ end }}
<div id="project-{{ $index }}" class="card">
<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-06-27 09:22:46 +00:00
<img src="{{ if .Params.image }}{{ .Params.image | relURL }}{{ else }}{{ (.Site.Params.placeHolderimg | default "/img/workday.jpg") | relURL }}{{ end }}">
2017-11-13 21:01:53 +00:00
</a>
2018-06-27 09:22:46 +00:00
</figure>
</div>
<div class="card-content has-text-centered top-pad">
<a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
{{ .Title }}
</a>
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-06-27 00:10:46 +00:00
<a href="{{ .RelPermalink }}">{{ 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-06-27 09:37:23 +00:00
{{ range $index, $element := .Pages.ByWeight | first $numberOfProjectsToShow }} {{ if not .Params.external_link }}
2018-06-27 09:22:46 +00:00
<div class="modal" id="modal-{{ $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">
<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>
2018-06-27 09:22:46 +00:00
<button class="modal-close is-large" aria-label="close" id="close-{{ $index }}"></button>
2017-03-13 09:14:02 +00:00
</div>
2018-06-25 13:03:18 +00:00
<script>
2018-06-27 09:22:46 +00:00
$('#project-{{ $index }}').click(function () {
$('#modal-{{ $index }}').addClass('is-active');
2018-06-25 13:03:18 +00:00
});
2018-06-27 09:22:46 +00:00
$('#close-{{ $index }}').click(function () {
$('#modal-{{ $index }}').removeClass('is-active');
2018-06-25 13:03:18 +00:00
});
2018-06-27 09:23:07 +00:00
$(document).keypress(function(e) {
if(e.which == 0) {
$('#modal-{{ $index }}').removeClass('is-active');
}
});
2018-06-25 13:03:18 +00:00
</script>
{{ end }} {{ end }}
{{ 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 }}