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

Commit

Permalink
Add sponsors partial
Browse files Browse the repository at this point in the history
Fixes #64
Fixes #30

Signed-off-by: Matt Stratton <[email protected]>
  • Loading branch information
mattstratton committed Dec 9, 2016
1 parent 7523523 commit 4794c8c
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions layouts/partials/sponsors.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{ $path := split $.Source.File.Path .Site.Params.pathseperator }}
{{ $event_slug := index $path 1 }}
{{ $e := (index $.Site.Data.events $event_slug) }}

{{- if $e.sponsors -}}
{{- range $index, $level := $e.sponsor_levels -}}
{{ $.Scratch.Set $level.id 0 }}

<div class="row">
<!--first sponsor row-->
<div class="col-md-12">
<h4>{{ $level.label }} Sponsors</h4>
{{- if ge (dateFormat "2006-01-02" $e.startdate) (dateFormat "2006-01-02" ($.Now.Format "2006-01-02")) -}}
{{- if ne $e.sponsors_accepted "no" -}}
{{- if or (not $level.max) (lt ($.Scratch.Get $level.id) $level.max) -}}
<a href = "/events/{{ $e.name }}/sponsor">
<i>Become a {{ $level.label }} Sponsor!</i>
</a>
{{- end -}}
{{- end -}}
{{- end -}}

<div class="row">
{{ $.Scratch.Set "i" 0 }}
{{- range where $e.sponsors "level" $level.id -}}
{{ $s := (index $.Site.Data.sponsors .id) }}
{{ if isset $.Site.Data.sponsors .id }}
{{ $.Scratch.Add $level.id 1 }}
{{ $.Scratch.Add "i" 1 }}
<div class = "col-md-3 col-sm-6 col-xs-6">
<a href = "{{ $s.url }}"><img alt = "{{ $s.name }}" title = "{{ $s.name }}" src = "/img/sponsors/{{ .id }}.png" class="img-responsive"></a>
</div>
{{ if modBool ($.Scratch.Get "i") 4 }}
</div>
<div class="row">
{{ end }}
{{- end -}}
{{- end -}}
</div>
</div>
</div>


{{- end -}}
{{- end -}}

0 comments on commit 4794c8c

Please sign in to comment.