mirror of
https://gitlab.com/ansol/web-ansol.org.git
synced 2024-11-21 22:01:31 +00:00
Organiza eventos no site de forma melhorzita
This commit is contained in:
parent
18753e9fad
commit
cf57f29f16
@ -1,45 +1,24 @@
|
||||
{{- define "main" -}}
|
||||
|
||||
<h1 class='events-list-title body-width'>Eventos</h1>
|
||||
<h1 class='events-list-title body-width'>Próximos eventos</h2>
|
||||
|
||||
{{ $query := where site.RegularPages "Type" "eventos" }}
|
||||
{{ $query = where $query "Params.metadata.event.date.finish" ">=" (now.Format "2006-01-02") }}
|
||||
{{ $query = sort $query "Params.metadata.event.date.start" }}
|
||||
<ul class="events-list body-width">
|
||||
{{ $paginator := .Paginate (.Data.Pages.ByParam "metadata.event.date.start").Reverse }}
|
||||
{{ range $query }}
|
||||
<li>{{ partial "evento" . }}</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
<h1 class='events-list-title body-width'>Eventos antigos</h2>
|
||||
<ul class="events-list body-width">
|
||||
{{ $query := where site.RegularPages "Type" "eventos" }}
|
||||
{{ $query = where $query "Params.metadata.event.date.finish" "<" (now.Format "2006-01-02") }}
|
||||
{{ $query = sort $query "Params.metadata.event.date.start" "desc" }}
|
||||
{{ $paginator := .Paginate $query }}
|
||||
{{ range $paginator.Pages }}
|
||||
<li>
|
||||
<a class="img" href="{{ .Permalink }}">
|
||||
{{ $cover := (index (.Resources.ByType "image") 0) }}
|
||||
{{ if not $cover }}
|
||||
{{ $cover = resources.Get "images/default-events-cover.png" }}
|
||||
{{ end }}
|
||||
<img class='event-cover' src="{{ $cover.Permalink }}" />
|
||||
</a>
|
||||
<div class="text">
|
||||
<p class="headline">
|
||||
<a class="title" href="{{ .Permalink }}">{{ .Title }}</a>
|
||||
</p>
|
||||
<p class="subheader">
|
||||
<span class="date">
|
||||
{{ with .Params.metadata.event.date }}
|
||||
{{ if eq (time.Format "2 January 2006" .start) (time.Format "2 January 2006" .finish) }}
|
||||
{{ if eq (time.Format "15:04" .start) (time.Format "15:04" .finish) }}
|
||||
{{ time.Format "2 de January de 2006" .start }}
|
||||
{{ else }}
|
||||
{{ time.Format "2 de January de 2006" .start }} das
|
||||
{{ time.Format "15:04" .start }} às
|
||||
{{ time.Format "15:04" .finish }}
|
||||
{{ end }}
|
||||
{{ else if eq (time.Format "January 2006" .start) (time.Format "January 2006" .finish) }}
|
||||
De {{ time.Format "2" .start }} a {{ time.Format "2 de January de 2006" .finish }}
|
||||
{{ else }}
|
||||
De {{ time.Format "2 de January de 2006" .start }} a {{ time.Format "2 de January de 2006" .finish }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</span>
|
||||
—
|
||||
<span class='location'>{{ .Params.metadata.event.location }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li>{{ partial "evento" . }}</li>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "pagination" . }}
|
||||
|
@ -74,6 +74,7 @@
|
||||
<ul class='events-list body-width'>
|
||||
{{ $query := where site.RegularPages "Type" "eventos" }}
|
||||
{{ $query = where $query "Params.metadata.event.date.finish" ">=" (now.Format "2006-01-02") }}
|
||||
{{ $query = sort $query "Params.metadata.event.date.start" }}
|
||||
{{ $query = first 3 $query }}
|
||||
|
||||
{{ range $post := $query }}
|
||||
|
34
themes/academic/layouts/partials/evento.html
Normal file
34
themes/academic/layouts/partials/evento.html
Normal file
@ -0,0 +1,34 @@
|
||||
<a class="img" href="{{ .Permalink }}">
|
||||
{{ $cover := (index (.Resources.ByType "image") 0) }}
|
||||
{{ if not $cover }}
|
||||
{{ $cover = resources.Get "images/default-events-cover.png" }}
|
||||
{{ end }}
|
||||
<img class='event-cover' src="{{ $cover.Permalink }}" />
|
||||
</a>
|
||||
<div class="text">
|
||||
<p class="headline">
|
||||
<a class="title" href="{{ .Permalink }}">{{ .Title }}</a>
|
||||
</p>
|
||||
<p class="subheader">
|
||||
<span class="date">
|
||||
{{ with .Params.metadata.event.date }}
|
||||
{{ if eq (time.Format "2 January 2006" .start) (time.Format "2 January 2006" .finish) }}
|
||||
{{ if eq (time.Format "15:04" .start) (time.Format "15:04" .finish) }}
|
||||
{{ time.Format "2 de January de 2006" .start }}
|
||||
{{ else }}
|
||||
{{ time.Format "2 de January de 2006" .start }} das
|
||||
{{ time.Format "15:04" .start }} às
|
||||
{{ time.Format "15:04" .finish }}
|
||||
{{ end }}
|
||||
{{ else if eq (time.Format "January 2006" .start) (time.Format "January 2006" .finish) }}
|
||||
De {{ time.Format "2" .start }} a {{ time.Format "2 de January de 2006" .finish }}
|
||||
{{ else }}
|
||||
De {{ time.Format "2 de January de 2006" .start }} a {{ time.Format "2 de January de 2006" .finish }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</span>
|
||||
—
|
||||
<span class='location'>{{ .Params.metadata.event.location }}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user