website/layouts/case-studies/list.html

68 lines
2.6 KiB
HTML
Raw Normal View History

{{ define "main" }}
{{ $pages := .Pages }}
{{ with $.Site.Params.language_alternatives }}
{{ range . }}
{{ with (where $.Translations ".Lang" . ) }}
{{ $p := index . 0 }}
{{ $pages = $pages | lang.Merge $p.Pages }}
{{ end }}
{{ end }}
{{ end }}
{{ $featured := (where $pages "Params.featured" true).ByWeight | first 4 }}
<section id="mainContent">
<main>
<div class="content">
<div class="case-studies">
{{ range $featured }}
{{ template "case-study-featured-block" (dict "ctx" $ "page" .) }}
{{ end }}
</div>
</div>
</main>
</section>
{{ $featuredVideos := where .Pages ".Params.video" "!=" nil }}
{{ with $featuredVideos }}
{{ with index $featuredVideos 0 }}
<section id="video">
<main>
<div>
<h4><i>"{{ .Params.quote | html }}"</i></h4>
{{ $img := .Resources.GetMatch "video.png" }}
{{ $small := .Resources.GetMatch "**small*.png" }}
{{ with $small }}<img src="{{ .RelPermalink }}" alt="{{ .Title }}">{{ end }}
</div>
<div style= "padding-left: 40px;"><button onclick="kub.showVideo()">{{ with $img }}<img src="{{ .RelPermalink }}" alt="Box video">{{ end }}<h6>Kubernetes at Box</h6></button></div>
</main>
<div id="videoPlayer">
<iframe data-url="{{ .Params.video | safeURL }}" frameborder="0" allowfullscreen="true"></iframe>
<button id="closeButton"></button>
</div>
</section>
{{ end }}
{{ end }}
<section id="users">
<main>
<h3>{{ .Title }}</h3>
<div id="usersGrid">
{{ range $pages.ByTitle }}
{{ $logo := .Resources.GetMatch "**logo*.png" }}
{{ $p := . }}
<a target="_blank" href="{{ with $p.Params.content_url }}{{ . | safeURL }}{{ else }}{{ .RelPermalink }}{{ end }}">{{ with $logo }}<img src="{{ .RelPermalink }}" alt="{{ $p.LinkTitle }}">{{ else }}
{{ errorf "Case Studies: Missing logo for %s. Put a PNG with the word 'logo' in the filename into %q" $p.LinkTitle $p.Dir }}
{{ end }}</a>
{{ end }}
<a target="_blank" href="https://docs.google.com/a/google.com/forms/d/e/1FAIpQLScuI7Ye3VQHQTwBASrgkjQDSS5TP0g3AXfFhwSM9YpHgxRKFA/viewform" class="tell-your-story"><img src="/images/case_studies/story.png" alt="Tell your story"></a>
</div>
</main>
</section>
{{ .Content }}
{{ end }}
{{ define "case-study-featured-block" }}
{{ $isForeignLanguage := (ne .page.Lang .ctx.Lang)}}
{{ $logo := .page.Resources.GetMatch "**{feature,logo}*.png" }}
<div class="case-study">
{{ with $logo }}<img src="{{ .RelPermalink }}" alt="{{ .Title }}">{{ end }}
<p class="quote">"{{ .page.Params.quote | html }}"</p>
<a href="{{ .page.RelPermalink }}"{{ if $isForeignLanguage }} target="_blank"{{ end }}>{{ T "main_read_about"}} {{ .page.LinkTitle }}</a>
</div>
{{ end }}