cach-radio/inc/themes/castanet/layouts/partials/row.html

321 lines
14 KiB
HTML
Raw Permalink Normal View History

2022-12-15 22:36:40 +01:00
{{ if isset .Site.Params "enable_jumbo" }}
{{ if eq .Site.Params.enable_jumbo "true" }}
{{- partial "jumbotron.html" . }}
{{ end }}
{{ end }}
{{ if and (and (isset .Site.Params "show_next_upcoming") (eq .Site.Params.show_next_upcoming "true")) (ge (len (where ( where site.RegularPages "Type" "in" site.Params.mainSections) ".Params.upcoming" "==" true )) 1) }}
<div class="row up_next_container">
<div class="col-md-12">
{{ range first 1 (where ( where site.RegularPages "Type" "in" site.Params.mainSections).ByDate ".Params.upcoming" "==" true ) }}
Next Episode: <a href="{{ .Permalink }}">{{ .Title }}</a> - Scheduled for {{ dateFormat "Jan 2, 2006" .Date }}
{{ end }}
</div>
</div>
{{ end }}
<div class="row hero_container">
<div class="col-md-12">
<h2>
Latest Episode
</h2>
{{ range first 1 (where ( where site.RegularPages "Type" "in" site.Params.mainSections) ".Params.upcoming" "!=" true ) }}
{{- with .Params.truncate -}}
{{- $.Scratch.Set "truncate" . }}
{{- else -}}
{{- with .Site.Params.truncate -}}
{{- $.Scratch.Set "truncate" . }}
{{- else -}}
{{- $.Scratch.Set "truncate" 600 -}}
{{- end -}}
{{- end -}}
{{- with .Params.youtube -}}
{{- if . -}}
{{- $.Scratch.Set "youtube" "true" -}}
{{- end -}}
{{- end -}}
{{- with .Params.episode_banner -}}
{{- $.Scratch.Set "episode_banner" "true" -}}
{{- end -}}
{{/* Begin youtube */}}
{{- if eq ($.Scratch.Get "youtube") "true" -}}
<div class = "row homepage_episode_row">
<div class = "col">
{{ if and (isset .Site.Params "episode_number_style") (.Params.episode) }}
{{ if eq .Site.Params.episode_number_style "parens" }}
<h2><a href="{{ .Permalink }}" class= "row_latest_episode_title">{{ .Title }}</a> ({{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }})</h2>
{{ else if eq .Site.Params.episode_number_style "brackets" }}
<h2><a href="{{ .Permalink }}" class= "row_latest_episode_title">{{ .Title }}</a> [{{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}]</h2>
{{ else if eq .Site.Params.episode_number_style "dash" }}
<h2><a href="{{ .Permalink }}" class= "row_latest_episode_title">{{ .Title }}</a> - {{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}</h2>
{{ else }}
<h2><a href="{{ .Permalink }}" class= "row_latest_episode_title">{{ .Title }}</a> ({{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }})</h2>
{{ end }}
{{ else }}
<h2><a href="{{ .Permalink }}" class= "row_latest_episode_title">{{ .Title }}</a></h2>
{{ end }}
<small>Posted on {{ dateFormat "Monday, Jan 2, 2006" .Date }} {{ partial "episode-metadata.html" .}}</small>
</div>
</div>
<div class = "row homepage_episode_row">
<div class = "col">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="//www.youtube.com/embed/{{ .Params.youtube }}" allowfullscreen></iframe>
</div>
</div>
</div>
<div class = "row homepage_episode_row">
<div class = "col">
{{ .Description | markdownify | truncate ($.Scratch.Get "truncate") " "}}&nbsp;<small><a href = "{{ .Permalink }}">Read More</a></small>
</div>
</div>
{{- else if eq ($.Scratch.Get "episode_banner") "true" -}}
<div class = "row homepage_episode_row">
<div class = "col">
{{ if and (isset .Site.Params "episode_number_style") (.Params.episode) }}
{{ if eq .Site.Params.episode_number_style "parens" }}
<h2><a href="{{ .Permalink }}" class= "row_latest_episode_title">{{ .Title }}</a> ({{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }})</h2>
{{ else if eq .Site.Params.episode_number_style "brackets" }}
<h2><a href="{{ .Permalink }}" class= "row_latest_episode_title">{{ .Title }}</a> [{{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}]</h2>
{{ else if eq .Site.Params.episode_number_style "dash" }}
<h2><a href="{{ .Permalink }}" class= "row_latest_episode_title">{{ .Title }}</a> - {{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}</h2>
{{ else }}
<h2><a href="{{ .Permalink }}" class= "row_latest_episode_title">{{ .Title }}</a> ({{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }})</h2>
{{ end }}
{{ else }}
<h2><a href="{{ .Permalink }}" class= "row_latest_episode_title">{{ .Title }}</a></h2>
{{ end }}
<small>Posted on {{ dateFormat "Monday, Jan 2, 2006" .Date }} {{ partial "episode-metadata.html" .}}</small>
</div>
</div>
<div class = "row homepage_episode_row">
<div class = "col">
<a href="{{ .Permalink }}"><img src="{{ .Params.episode_banner | absURL }}" class="img-fluid episode_image"/></a>
</div>
</div>
<div class = "row homepage_episode_row">
<div class = "col">
{{ .Description | markdownify | truncate ($.Scratch.Get "truncate") " "}}&nbsp;<small><a href = "{{ .Permalink }}">Read More</a></small>
</div>
</div>
{{- else -}}
<!-- begin square row -->
<div class = "row homepage_episode_row">
<div class = "col-md-12">
<a href="{{ .Permalink }}" class = "row_latest_episode_title"><h2>{{ .Title }}</h2></a>
<small>Posted on {{ dateFormat "Monday, Jan 2, 2006" .Date }} {{ partial "episode-metadata.html" .}}</small>
</div>
</div>
{{- if .Params.episode_image -}}
<div class = "row homepage_episode_row">
<div class = "col-md-3">
<a href="{{ .Permalink }}"><img class = "img-fluid" src = "{{ .Params.episode_image | absURL }}" /></a>
</div>
<div class = "col-md-9">
{{- if ge (countrunes .Description ) ($.Scratch.Get "truncate") -}}
<p class = "hompage_episode_description">{{ .Description | markdownify | truncate ($.Scratch.Get "truncate") " "}}&nbsp;<small><a href = "{{ .Permalink }}">Read More</a></small></p>
{{- else -}}
<p class = "hompage_episode_description">{{ .Description | markdownify }}</p>
{{- end -}}
</div>
</div><!-- end square row -->
{{- else -}}
<div class = "col">
{{- if ge (countrunes .Description ) ($.Scratch.Get "truncate") -}}
<p class = "hompage_episode_description">{{ .Description | markdownify | truncate ($.Scratch.Get "truncate") " "}}&nbsp;<small><a href = "{{ .Permalink }}">Read More</a></small></p>
{{- else -}}
<p class = "hompage_episode_description">{{ .Description | markdownify }}</p>
{{- end -}}
</div>
{{- end -}}
{{- end -}}
{{- with .Params.podcast_file -}}
<div class = "row homepage_episode_row">
<div class = "col-md-12">
<audio id="player2" style="width: 100%" controls preload="none">
<source src="{{ $.Site.Params.media_prefix }}{{ . }}" type="audio/mp3">
</audio>
</div>
</div>
{{- end -}}
{{- end -}}
</div>
</div>
<section class="episode-list">
<!-- rest of episodes -->
{{- if (where site.RegularPages "Type" "in" site.Params.mainSections) -}}
{{- $paginator := .Paginate (after 1 (where ( where site.RegularPages "Type" "in" site.Params.mainSections) ".Params.upcoming" "!=" true )) }}
{{- $list := (where ( where site.RegularPages "Type" "in" site.Params.mainSections) ".Params.upcoming" "!=" true ) -}}
{{- $len := (len $list) -}}
<div class="row main_container">
{{- with .Site.Params.enable_jumbo -}}
{{- if eq . "true" -}}
<div class = "col">
{{- else -}}
<div class="col-md-8">
{{- end -}}
{{- else -}}
<div class="col-md-8">
{{- end -}}
{{- if gt $len 1 -}}
{{- range $paginator.Pages -}}
{{- with .Params.truncate -}}
{{- $.Scratch.Set "truncate" . }}
{{- else -}}
{{- with .Site.Params.truncate -}}
{{- $.Scratch.Set "truncate" . }}
{{- else -}}
{{- $.Scratch.Set "truncate" 600 -}}
{{- end -}}
{{- end -}}
<div class = "row homepage_episode_row">
<div class = "col-md-12">
{{ if and (isset .Site.Params "episode_number_style") (.Params.episode) }}
{{ if eq .Site.Params.episode_number_style "parens" }}
<h3><a href="{{ .Permalink }}" class= "grid_episode_title">{{ .Title }}</a> ({{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }})</h3>
{{ else if eq .Site.Params.episode_number_style "brackets" }}
<h3><a href="{{ .Permalink }}" class= "grid_episode_title">{{ .Title }}</a> [{{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}]</h3>
{{ else if eq .Site.Params.episode_number_style "dash" }}
<h3><a href="{{ .Permalink }}" class= "grid_episode_title">{{ .Title }}</a> - {{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}</h3>
{{ else }}
<h3><a href="{{ .Permalink }}" class= "grid_episode_title">{{ .Title }}</a> ({{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }})</h3>
{{ end }}
{{ else }}
<h3><a href="{{ .Permalink }}" class= "grid_episode_title">{{ .Title }}</a></h3>
{{ end }}
<small>Posted on {{ dateFormat "Monday, Jan 2, 2006" .Date }} {{ partial "episode-metadata.html" .}}</small>
</div>
</div>
<div class = "row homepage_episode_row">
{{- if .Params.episode_image -}}
<div class = "col-md-3 homepage_episode_row_image">
<a href="{{ .Permalink }}"><img class = "img-fluid" src = "{{ .Params.episode_image | absURL }}" /></a>
</div>
<div class = "col-md-9 homepage_episode_row_description">
{{- if ge (countrunes .Description ) ($.Scratch.Get "truncate") -}}
<p class = "homepage_episode_description">{{ .Description | markdownify | truncate ($.Scratch.Get "truncate") " "}}&nbsp;<small><a href = "{{ .Permalink }}">Read More</a></small></p>
{{- else -}}
<p class = "homepage_episode_description">{{ .Description | markdownify }}</p>
{{- end -}}
</div>
{{- else -}}
<div class = "col">
{{- if ge (countrunes .Description ) ($.Scratch.Get "truncate") -}}
<p class = "homepage_episode_description">{{ .Description | markdownify | truncate ($.Scratch.Get "truncate") " "}}&nbsp;<small><a href = "{{ .Permalink }}">Read More</a></small></p>
{{- else -}}
<p class = "homepage_episode_description">{{ .Description | markdownify }}</p>
{{- end -}}
</div>
{{- end -}}
</div>
{{- end -}}
{{- end -}}
</div>
{{- if isset .Site.Params "enable_jumbo" -}}
{{- if ne .Site.Params.enable_jumbo "true" -}}
<div class="col-md-4 sidebar_col">
{{- partial "sidebar.html" . -}}
</div>
{{- end -}}
{{- else -}}
<div class="col-md-4 sidebar_col">
{{- partial "sidebar.html" . -}}
</div>
{{- end -}}
</div>
<div class="row">
<div class="col-md-12">
{{- if gt $paginator.TotalPages 1 -}}
<div class = "row">
<div class = "col">
<nav class="pagination justify-content-center">
{{ $pag := $.Paginator }}
{{ $window := $.Site.Params.paginateWindow | default 1 }}
{{ if gt $pag.TotalPages 1 }}
{{ $total := $pag.TotalPages }}
{{ $size := add 5 (add $window $window) }}
{{ $cur := $pag.PageNumber }}
{{ if gt $total $size }}
{{ if lt $cur (sub $size (add $window 1)) }}
{{ $.Scratch.Set "show" (seq 1 (sub $size 2)) }}
{{ else if lt (sub $total $cur) (sub $size (add $window 2)) }}
{{ $.Scratch.Set "show" (seq (add (sub $total $size) 3) $total) }}
{{ else }}
{{ $.Scratch.Set "show" (seq (sub $cur $window) (add $cur $window)) }}
{{ end }}
{{ $.Scratch.Add "show" 1 }}
{{ $.Scratch.Add "show" $total }}
{{ else }}
{{ $.Scratch.Set "show" (seq 1 $total) }}
{{ end }}
<ul class="pagination pagination-lg">
<!-- first page button -->
{{if $paginator.HasPrev }}
{{ if gt $paginator.PageNumber 2 }}
{{- with $paginator.First -}}
{{- $url := trim (string .URL) "/" | absURL -}}
<li class="page-item">
<a href="{{ $url }}" aria-label="First" class="page-link"><span aria-hidden="true">&laquo;&laquo;</span></a>
</li>
{{- end -}}
{{ end }}
{{ end }}
<!-- prev page button -->
{{- with $paginator.HasPrev -}}
<li class="page-item">
<a href="{{ $paginator.Prev.URL }}" class="page-link"> &laquo; </a>
</li>
{{ end }}
<!-- page # buttons -->
{{ range $pag.Pagers }}
{{ $cur := .PageNumber }}
{{- $url := trim (string .URL) "/" | absURL -}}
{{ if in ($.Scratch.Get "show") $cur }}
<li class = "{{ if eq . $pag }}active{{ end }} page-item"><a href="{{ .URL }}" class="page-link hidden-md-down">{{ .PageNumber }}</a></li>
{{ else if in (slice 2 (sub $total 1)) $cur }}
<li class="disabled page-item"><a name="" class="page-link hidden-md-down">&hellip;</a></li>
{{ end }}
{{ end }}
<!-- next page button -->
{{- with $paginator.HasNext -}}
<li class="page-item">
<a href="{{ $paginator.Next.URL }}" class="page-link"> &raquo; </a>
</li>
{{ end }}
<!-- last page button -->
{{ if lt $paginator.PageNumber (sub $paginator.TotalPages 1) }}
{{- with $paginator.Last -}}
{{- $url := trim (string .URL) "/" | absURL -}}
<li class="page-item">
<a href="{{ $url }}" aria-label="Last" class="page-link"><span aria-hidden="true">&raquo;&raquo;</span></a>
</li>
{{- end -}}
{{ end }}
</ul>
{{ end }}
</nav>
</div>
</div>
{{- end -}}
</div>
{{- end -}}
</div>
</div> <!-- end section -->