Skip to content

Commit

Permalink
Merge pull request devopsdays#136 from devopsdays/mattstratton/add-ev…
Browse files Browse the repository at this point in the history
…ent-site-partials

Create partials for event pages. Fixes devopsdays#135

Former-commit-id: fd8ccfa
  • Loading branch information
mattstratton committed Apr 14, 2016
2 parents e471370 + b330dbb commit 5b8769b
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 103 deletions.
56 changes: 2 additions & 54 deletions themes/devopsdays-legacy/layouts/event/single.html
Original file line number Diff line number Diff line change
@@ -1,61 +1,9 @@
{{ partial "header.html" . }}

{{/*
This section is what creates the query to get at all the site data. If you need this somewhere, you can just copy
it and paste it. Need to figure out if a partial would expose the variables/elements/array created herein. It could be done in a partial (need to include the trailing .) but I don't think it would work in shortcodes, which is where we need it the most - mattstratton
*/}}
{{ partial "event_header.html" . }}

{{ $path := split $.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $e := (index $.Site.Data.events $event_slug) }}

{{/* end site data query */}}

<div class = "container-fluid">
<div class="row">
<div class="col-md-8">
<h1> {{ $e.city }} {{ $e.year }} - {{ title .Title }} </h1>
<!-- Main navigation -->
<div class="submenu">
<h3>
{{ if $e.nav_elements }}
{{ range $e.nav_elements }}
{{ if .url }}
<a href="{{ .url}}">{{ .name }}</a>&nbsp;
{{ else }}
<a href="/events/{{ $event_slug }}/{{ .name }}">{{ .name }}</a>&nbsp;
{{ end }}
{{ end }}
{{ else }}
{{ range $navigation := $e.navigationelements}}
<a href="/events/{{ $event_slug }}/{{ $navigation}}">{{ $navigation }}</a>&nbsp;
{{ end }}
{{ end }}
</h3>
</div>
<!-- end main navigation -->

{{ .Content }}
</div>
<div class="col-md-4">
<!-- sponsor code begin -->
{{ $sponsors := $e.sponsors }}
{{ range $e.sponsor_levels }}
<h2>{{ .label }} Sponsors</h2>
{{ range where $sponsors "level" .id }}
{{ $s := (index $.Site.Data.sponsors .id) }}
{{ if isset $.Site.Data.sponsors .id }}
<a href = "{{ $s.url }}"><img alt = "{{ .id }}" src = "/img/sponsors/{{ .id }}.png" class="img-responsive company-logo" width = "95px"></a>
{{ end }}
{{ end }}
<div class = "sponsor-cta">
<a href = "/events/{{ $e.friendly }}/sponsor">Become a {{ .label }} Sponsor!</a>
</div>
{{ end }}

<!-- sponsor code end -->
</div>
</div>

</div>
{{ partial "footer.html" . }}
{{ partial "event_footer.html" . }}
30 changes: 30 additions & 0 deletions themes/devopsdays-legacy/layouts/partials/event_footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ $path := split $.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $e := (index $.Site.Data.events $event_slug) }}

</div>



<div class="col-md-4">
<!-- sponsor code begin -->
{{ $sponsors := $e.sponsors }}
{{ range $e.sponsor_levels }}
<h2>{{ .label }} Sponsors</h2>
{{ range where $sponsors "level" .id }}
{{ $s := (index $.Site.Data.sponsors .id) }}
{{ if isset $.Site.Data.sponsors .id }}
<a href = "{{ $s.url }}"><img alt = "{{ .id }}" src = "/img/sponsors/{{ .id }}.png" class="img-responsive company-logo" width = "95px"></a>
{{ end }}
{{ end }}
<div class = "sponsor-cta">
<a href = "/events/{{ $e.friendly }}/sponsor">Become a {{ .label }} Sponsor!</a>
</div>
{{ end }}

<!-- sponsor code end -->
</div>
</div>

</div>
{{ partial "footer.html" . }}
27 changes: 27 additions & 0 deletions themes/devopsdays-legacy/layouts/partials/event_header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{ partial "header.html" . }}

<!-- put the event partial header here -->

{{/*
This section is what creates the query to get at all the site data. If you need this somewhere, you can just copy
it and paste it. Need to figure out if a partial would expose the variables/elements/array created herein. It could be done in a partial (need to include the trailing .) but I don't think it would work in shortcodes, which is where we need it the most - mattstratton
*/}}

{{ $path := split $.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $e := (index $.Site.Data.events $event_slug) }}

{{/* end site data query */}}

<div class = "container-fluid">
<div class="row">
<div class="col-md-8">
<h1> {{ $e.city }} {{ $e.year }} - {{ title .Title }} </h1>
<!-- Main navigation -->
<div class="submenu">
<h3>
{{ range $navigation := $e.navigationelements}}
<a href="/events/{{ $event_slug }}/{{ $navigation}}">{{ $navigation }}</a>&nbsp;
{{ end }}
</h3>
</div>
53 changes: 4 additions & 49 deletions themes/devopsdays-legacy/layouts/talk/single.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
{{ partial "header.html" . }}

{{/*
This section is what creates the query to get at all the site data. If you need this somewhere, you can just copy
it and paste it. Need to figure out if a partial would expose the variables/elements/array created herein. It could be done in a partial (need to include the trailing .) but I don't think it would work in shortcodes, which is where we need it the most - mattstratton
*/}}
{{ partial "event_header.html" . }}

{{ $path := split $.Source.File.Path "/" }}
{{ $event_slug := index $path 1 }}
{{ $event := (print .Params.year (lower .Params.city)) }}
{{ $e := (index $.Site.Data.events $event_slug) }}

{{/* end site data query */}}

<div class = "container-fluid">
<div class="row">
<div class="col-md-8">
<h1> {{ $e.city }} {{ $e.year }} - {{ title .Title }} </h1>
<!-- Main navigation -->
<div class="submenu">
<h3>
{{ range $navigation := $e.navigationelements}}
<a href="/events/{{ $event_slug }}/{{ $navigation}}">{{ $navigation }}</a>&nbsp;
{{ end }}
</h3>
</div>
<!-- end event header partial -->

{{ .Content }}

Expand Down Expand Up @@ -52,30 +32,5 @@ <h3>{{ $s.name }}</h3>




</div>



<div class="col-md-4">
<!-- sponsor code begin -->
{{ $sponsors := $e.sponsors }}
{{ range $e.sponsor_levels }}
<h2>{{ .label }} Sponsors</h2>
{{ range where $sponsors "level" .id }}
{{ $s := (index $.Site.Data.sponsors .id) }}
{{ if isset $.Site.Data.sponsors .id }}
<a href = "{{ $s.url }}"><img alt = "{{ .id }}" src = "/img/sponsors/{{ .id }}.png" class="img-responsive company-logo" width = "95px"></a>
{{ end }}
{{ end }}
<div class = "sponsor-cta">
<a href = "/events/{{ $e.friendly }}/sponsor">Become a {{ .label }} Sponsor!</a>
</div>
{{ end }}

<!-- sponsor code end -->
</div>
</div>

</div>
{{ partial "footer.html" . }}
<!-- put the event partial here and delete everything after it -->
{{ partial "event_footer.html" . }}

0 comments on commit 5b8769b

Please sign in to comment.