2023-11-08 01:02:19 -05:00

189 lines
9.0 KiB
HTML

{{ define "hero" }}
{{ partial "hero" (dict "title" .Params.title ) }}
{{ end }}
{{ define "main" }}
<!-- Set the page context in a variable in a loop. -->
{{ $pageContext := . }}
<!-- Grab the webinar and event page data. -->
{{ $webinars := (where $.Site.Pages "Type" "webinars") }}
{{ $events := (where $.Site.Pages "Type" "events") }}
{{ $aiAnswers := (where $.Site.Pages "Type" "ai-answers") }}
<!-- Create dicts so we can sort the resources by start/publish date. -->
{{ $resourcesWithDate := slice }}
<!-- Create the resource data dicts for webinars. -->
{{ range $webinars }}
<!-- If the webinar is not marked as unlisted we will add it to the list. -->
{{ if eq .Params.unlisted false }}
<!-- If the webinar has multiple sessions we will choose the earliest session -->
{{ if isset .Params "multiple" }}
{{ $multipleEventData := . }}
{{ range .Params.multiple }}
{{ $resourcesWithDate = $resourcesWithDate | append (dict "date" .datetime "data" $multipleEventData) }}
{{ end }}
{{ else }}
{{ $resourcesWithDate = $resourcesWithDate | append (dict "date" .Params.main.sortable_date "data" .) }}
{{ end }}
{{ end }}
{{ end }}
<!-- Create the resource data dicts for events. -->
{{ range $events }}
<!-- If the webinar is not marked as unlisted we will add it to the list. -->
{{ if ne .Params.unlisted true }}
{{ $resourcesWithDate = $resourcesWithDate | append (dict "date" .Params.main.start_date "data" .) }}
{{ end }}
{{ end }}
<!-- Create the resource data dicts for AI answers. -->
{{ range $aiAnswers }}
{{ $resourcesWithDate = $resourcesWithDate | append (dict "date" .Date "data" .) }}
{{ end }}
<div class="pulumi-event-list-container mt-5">
<div class="container mx-auto pt-10">
<!-- These hidden elements help select the children elements so we can use CSS -->
<!-- to have the filter, well filter. -->
<span id="all" class="hidden"></span>
<span id="featured" class="hidden"></span>
<span id="upcoming" class="hidden"></span>
<span id="videos" class="hidden"></span>
<span id="ai-answers" class="hidden"></span>
<span id="whitepapers" class="hidden"></span>
<!-- The event filter -->
<div class="pulumi-event-list-container justify-center event-list-filter container mx-auto flex">
<div class="scroll-container hidden lg:flex items-center">
<button id="slideBackwards"><i class="text-gray-500 text-3xl fas fa-angle-left"></i></button>
</div>
<ul id="event-list-filter-nav">
{{ range $item := .Params.sections }}
<li data-filter-name="{{ $item.anchor }}">
<a class="whitespace-nowrap" href="#{{ $item.anchor }}">
<i class="fas fa-{{ $item.icon }} mr-2"></i>
<span>{{ $item.label }}</span>
</a>
</li>
{{ end }}
</ul>
<div class="scroll-container hidden lg:flex items-center">
<button id="slideForward"><i class="text-gray-500 text-3xl fas fa-angle-right"></i></button>
</div>
</div>
<!-- Titles for the filtered section -->
<h3 class="ml-5 text-black" data-filter-title="all"><i class="fas fa-asterisk mr-8"></i>All</h3>
<h3 class="hidden ml-5 text-black" data-filter-title="featured"><i class="fas fa-star mr-8"></i>Featured</h3>
<h3 class="hidden ml-5 text-black" data-filter-title="upcoming"><i class="fas fa-users mr-8"></i>Upcoming Sessions</h3>
<h3 class="hidden ml-5 text-black" data-filter-title="videos"><i class="fas fa-video mr-8"></i>Videos</h3>
<h3 class="hidden ml-5 text-black" data-filter-title="ai-answers"><i class="fas fa-comments mr-8"></i>Pulumi AI Answers</h3>
<h3 class="hidden ml-5 text-black" data-filter-title="whitepapers"><i class="fas fa-book mr-8"></i>Whitepapers</h3>
<!-- Resources list. -->
<ul class="flex flex-wrap justify-center list-none p-0 sm:p-2 resource-list">
<!-- Loop over the resource items and create the tiles. -->
{{ range sort $resourcesWithDate "date" "desc" }}
{{ $data := .data }}
<!-- Create the values for rendering. -->
{{ $description := "" }}
{{ $displayDate := "" }}
{{ $link := "" }}
{{ $external := false }}
{{ $icon := "users" }}
{{ $filters := slice "all" }}
<!-- create values to determine if date is upcoming -->
{{ $nowUnix := now.UnixNano }}
<!-- add 24 hours to event date to list it for an extra day -->
{{ $eventDateUnix := (add (.date | time.AsTime).UnixNano (duration "hour" 24).Milliseconds) }}
<!-- Set the values based on the type of the page. -->
{{ if eq $data.Type "webinars" }}
{{ $description = $data.Params.meta_desc }}
{{ $displayDate = dateFormat "January 2, 2006" .date }}
{{ if $data.Params.main.hide_date }}
{{ $displayDate = "To be announced" }}
{{ end }}
<!-- Set the url to link to. -->
{{ if $data.Params.external }}
{{ $link = $data.Params.url_slug }}
{{ $external = true }}
{{ else }}
{{ $link = printf "/resources/%s" $data.Params.url_slug }}
{{ end }}
{{ if isset $data.Params "multiple" }}
{{ $link = printf "%s/?date=%s" $link (dateFormat "2006/01/02" .date) }}
{{ end }}
<!-- If the webinar is featured add the feature filter. -->
{{ if $data.Params.featured }}
{{ $filters = $filters | append "featured" }}
{{ end }}
<!-- Set the icon and appropriate filters for the webinar. -->
{{ if $data.Params.whitepaper }}
{{ $icon = "book" }}
{{ $filters = $filters | append "whitepapers" }}
{{ else if $data.Params.pulumi_tv }}
{{ $icon = "tv" }}
{{ $filters = $filters | append "pulumitv" }}
{{ else if $data.Params.pre_recorded }}
{{ $icon = "video" }}
{{ $filters = $filters | append "videos" }}
{{ else if lt $nowUnix $eventDateUnix }}
{{ $filters = $filters | append "upcoming" }}
{{ end }}
{{ else if eq $data.Type "events" }}
<!-- Set the appropriate values for the event. -->
{{ $description = $data.Params.event.description }}
{{ $displayDate = dateFormat "January 2, 2006" $data.Params.event.start_date }}
{{ $filters = $filters | append "upcoming" }}
{{ if $data.Params.main.hide_date }}
{{ $displayDate = "Date to be announced" }}
{{ end }}
<!-- If the event has a redirect attribute it is external so set the link correctly. -->
{{ if $data.Params.redirect_to }}
{{ $link = $data.Params.url_slug }}
{{ $external = true }}
{{ else }}
{{ $link = printf "/resources/%s" $data.Params.url_slug }}
{{ end }}
{{ else if eq $data.Type "ai-answers" }}
{{ $filters = $filters | append "ai-answers" }}
{{ $icon = "comments" }}
{{ $description = $data.Params.meta_desc }}
{{ $displayDate = dateFormat "January 2, 2006" $data.Date }}
{{ $link = $data.RelPermalink }}
{{ end }}
{{ $tileOptions := (dict "multiple" $data.Params.multiple "pageContext" $pageContext "external" $external "filters" $filters "link" $link "icon" $icon "description" $description "displayDate" $displayDate "data" $data) }}
{{ partial "content-tile.html" $tileOptions }}
{{ end }}
</ul>
</div>
</div>
{{ end }}