From ec7bc6a0007811f377dfc040a6818a5abdd0d2bc Mon Sep 17 00:00:00 2001 From: Matt Stratton Date: Thu, 2 Feb 2017 11:40:02 -0600 Subject: [PATCH] Add dynamic CTA buttons on welcom pages Signed-off-by: Matt Stratton --- exampleSite/data/events/2017-ponyville.yml | 6 ++- layouts/partials/events/cta.html | 47 ++++++++++++++++++++++ layouts/partials/welcome.html | 4 +- 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 layouts/partials/events/cta.html diff --git a/exampleSite/data/events/2017-ponyville.yml b/exampleSite/data/events/2017-ponyville.yml index 2648c5af1..865a1d8bc 100644 --- a/exampleSite/data/events/2017-ponyville.yml +++ b/exampleSite/data/events/2017-ponyville.yml @@ -13,6 +13,10 @@ location: "Applejack House" newnav: "yes" event_logo_square: 'logo-square.jpg' event_twitter: "mattstratton" +registration_open: "true" +registration_link: "" +cfp_open: "true" +cfp_link: "" # navigationelements: ["welcome", "contact", "location", "program", "propose", "proposals", "conduct", "sponsor"] nav_elements: @@ -21,7 +25,7 @@ nav_elements: # url: http://cfp.devopsdayschi.org - name: program - name: speakers - # - name: registration + - name: registration - name: sponsor - name: volunteer - name: location diff --git a/layouts/partials/events/cta.html b/layouts/partials/events/cta.html new file mode 100644 index 000000000..b38d88fda --- /dev/null +++ b/layouts/partials/events/cta.html @@ -0,0 +1,47 @@ +{{/* site data query copypasta */}} +{{ $path := split $.Source.File.Path .Site.Params.pathseperator }} +{{ $event_slug := index $path 1 }} +{{ $e := (index $.Site.Data.events $event_slug) }} +{{/* end site data query */}} + +{{ if $e.registration_open }} + {{ if eq $e.registration_open "true" }} + {{ if $e.registration_link }} + {{ if eq $e.registration_link "" }} + {{ $.Scratch.Set "registration_link" (printf "/events/%s/register" $event_slug)}} + {{ else }} + {{ $.Scratch.Set "registration_link" $e.registration_link }} + {{ end }} + {{ else }} + {{ $.Scratch.Set "registration_link" (printf "/events/%s/register" $event_slug)}} + + {{ end }} + Register + {{ end }} +{{ end }} + + + +{{ if $e.cfp_open }} + {{ if eq $e.cfp_open "true" }} + {{ if $e.cfp_link }} + {{ if eq $e.cfp_link "" }} + {{ $.Scratch.Set "cfp_link" (printf "/events/%s/propose" $event_slug)}} + {{ else }} + {{ $.Scratch.Set "cfp_link" $e.cfp_link }} + {{ end }} + {{ else }} + {{ $.Scratch.Set "cfp_link" (printf "/events/%s/propose" $event_slug)}} + + {{ end }} + Propose + {{ end }} +{{ end }} + + +{{ if $e.event_twitter }} + {{ if ne $e.event.twitter "" }} + Follow + {{ end }} +{{ end }} +
diff --git a/layouts/partials/welcome.html b/layouts/partials/welcome.html index 330fdf086..67c08bf81 100644 --- a/layouts/partials/welcome.html +++ b/layouts/partials/welcome.html @@ -36,9 +36,7 @@

DevOpsDays {{ $e.city }}

{{- end -}}
{{ end }} - - -
+ {{ partial "events/cta.html" . }}