Skip to content
This repository has been archived by the owner on Jul 21, 2019. It is now read-only.

Add dynamic CTA buttons on welcome pages #168

Merged
merged 1 commit into from
Feb 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion exampleSite/data/events/2017-ponyville.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
47 changes: 47 additions & 0 deletions layouts/partials/events/cta.html
Original file line number Diff line number Diff line change
@@ -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 */}}
<!-- register button -->
{{ 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 }}
<a href="{{ $.Scratch.Get "registration_link" }}" class="btn btn-primary active" role="button" aria-pressed="true">Register</a>
{{ end }}
{{ end }}

<!-- propose button -->
<!-- register button -->
{{ 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 }}
<a href="{{ $.Scratch.Get "cfp_link" }}" class="btn btn-primary active" role="button" aria-pressed="true">Propose</a>
{{ end }}
{{ end }}

<!-- follow on twitter button -->
{{ if $e.event_twitter }}
{{ if ne $e.event.twitter "" }}
<a href="https://twitter.com/{{$e.event_twitter}}" class="btn btn-primary active" role="button" aria-pressed="true">Follow</a>
{{ end }}
{{ end }}
<div id="share"></div>
4 changes: 1 addition & 3 deletions layouts/partials/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ <h2>DevOpsDays {{ $e.city }}</h2>
{{- end -}}
<br />
{{ end }}
<button type="button" class="btn btn-default">Register</button>
<button type="button" class="btn btn-default">Follow</button>
<div id="share"></div>
{{ partial "events/cta.html" . }}

</div>
<div class="col-xs-12 col-md-4">
Expand Down