Skip to content

Commit

Permalink
fix and refacto block event
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisben committed Oct 5, 2023
1 parent 53e7886 commit 9ef4031
Showing 1 changed file with 5 additions and 50 deletions.
55 changes: 5 additions & 50 deletions layouts/partials/blocks/templates/agenda.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,58 +20,13 @@
{{ end -}}

<div class="events">
{{ range .elements }}
<article class="event" itemscope itemtype="https://schema.org/Event">
{{ if .data.image }}
{{- $direction = partial "GetImageDirection" .data.image -}}
{{ end }}
<div class="event-content">
{{- $title := partial "PrepareHTML" .title -}}
<h3><a href="{{ .url }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" $title)) }}" itemprop="name">{{ $title }}</a></h3>
{{ if site.Params.events.index.show_description }}
{{- if (partial "GetTextFromHTML" .summary) -}}
<p itemprop="description">
{{ if site.Params.events.index.truncate_description }}
{{ partial "GetTruncateContent" ( dict
"text" .summary
"length" site.Params.events.index.truncate_description
) }}
{{ else }}
{{ partial "PrepareText" .summary }}
{{ end }}
</p>
{{- end -}}
{{- end -}}
</div>

<div class="event-dates" itemprop="startDate" content="{{- if .dates.from.day -}}{{ .dates.from.day }}{{- end -}} {{- if .dates.from.hour -}}{{ .dates.from.hour }}{{- end -}}">
<!-- TODO : trouver une solution pour placer le intemprop EndDate -->
{{ .dates.computed.short }}
<div class="event-time">
{{ if .dates.from.hour }}
<span>{{ .dates.from.hour }}</span>
{{ end }}
{{ if .dates.to.hour }}
<span> {{ .dates.to.hour }}</span>
{{ end }}
</div>
</div>

<div class="media">
{{- if .image -}}
{{- partial "commons/image.html"
(dict
"image" .image
"sizes" site.Params.image_sizes.sections.events.item
) -}}
{{- else if site.Params.events.default_image -}}
{{- partial "commons/image-default.html" -}}
{{- end -}}
</div>
</article>
{{ range .events }}
{{ $event := site.GetPage .file }}
{{ with $event }}
{{ partial "events/event" (dict "event" . ) }}
{{ end -}}
{{ end -}}
</div>

</div>
</div>
</div>
Expand Down

0 comments on commit 9ef4031

Please sign in to comment.