Skip to content
Snippets Groups Projects
Unverified Commit b2f039dc authored by Alexis BENOIT's avatar Alexis BENOIT Committed by GitHub
Browse files

Partiel pour les liens de téléchargement accessible (#489)

parent f2702f39
No related branches found
No related tags found
No related merge requests found
......@@ -108,6 +108,7 @@ commons:
link:
blank: extern link
blank_aria: “{{ .Title }}” - extern link
download: “Download {{ .Title }}” - extern link
menu:
label: Toggle navigation
legal: Legals menu
......
......@@ -108,6 +108,7 @@ commons:
link:
blank: lien externe
blank_aria: “{{ .Title }}” - lien externe
download: Télécharger “{{ .Title }}” - lien externe
menu:
label: Ouvrir / Fermer le menu
legal: Menu pages légales
......
......@@ -14,32 +14,15 @@
<ul class="files">
{{- range .files }}
{{ if ne .id "" }}
{{- $file := partial "GetMedia" .id -}}
{{ if $file }}
{{ if partial "GetMedia" .id }}
<li>
{{- $title := .title -}}
{{- if (not $title) }}
{{ $title = $file.name }}
{{ end -}}
{{- $size := partial "GetHumanSize" $file.size -}}
{{- $extension := partial "GetExtensionFile" $file.name -}}
{{- $extension_with_size := (printf "%.2f %s - %s" $size.weight $size.unit $extension) -}}
{{- $title_with_size := printf "%s (%s)" $title $extension_with_size -}}
{{- $url := $file.url -}}
{{- if site.Params.keycdn -}}
{{- $url = $file.direct_url -}}
{{- end -}}
{{ if $file }}
<figure>
<a href="{{ $url }}" download="{{ partial "PrepareHTML" $file.name }}" target="_blank" title="{{ i18n "commons.link.blank_aria" (dict "Title" $title_with_size) }}">
{{ $title }}
</a>
<figcaption>
<abbr title="{{ i18n (printf "commons.extensions.%s" $extension) }}">{{ $extension }}</abbr>
- {{ $size.weight }} <abbr title="{{ $size.full_unit }}">{{ $size.unit }}</abbr>
</figcaption>
</figure>
{{ end }}
<figure>
{{ partial "commons/download-link" (dict
"id" .id
"title" .title
"with_caption" true
) }}
</figure>
</li>
{{ end -}}
{{ end -}}
......
{{ $file := partial "GetMedia" .id }}
{{ $title := .title }}
{{ $with_caption := .with_caption }}
{{ if $file }}
{{ if (not $title) }}
{{ $title = $file.name }}
{{ end }}
{{ $a11y_title := $title }}
{{ if .use_filename_for_a11y_title }}
{{ $a11y_title = $file.name }}
{{ end }}
{{ $size := partial "GetHumanSize" $file.size }}
{{ $extension := partial "GetExtensionFile" $file.name }}
{{ $extension_with_size := (printf "%.2f %s - %s" $size.weight $size.unit $extension) }}
{{ $title_with_size := printf "%s (%s)" $a11y_title $extension_with_size }}
{{ $url := $file.url }}
{{ if site.Params.keycdn }}
{{ $url = $file.direct_url }}
{{ end }}
<a href="{{ $url }}" download="{{ partial "PrepareHTML" $file.name }}" target="_blank" title="{{ i18n "commons.link.download" (dict "Title" $title_with_size) }}">
{{ $title }}
</a>
{{ if .with_caption }}
<figcaption>
<abbr title="{{ i18n (printf "commons.extensions.%s" $extension) }}">{{ $extension }}</abbr>
- {{ $size.weight }} <abbr title="{{ $size.full_unit }}">{{ $size.unit }}</abbr>
</figcaption>
{{ end }}
{{ end }}
\ No newline at end of file
......@@ -33,16 +33,11 @@
</div>
{{ end }}
{{ with .Params.downloadable_summary }}
{{- $file := partial "GetMedia" . -}}
{{- if $file -}}
{{- $url := $file.url -}}
{{- if site.Params.keycdn -}}
{{- $url = $file.direct_url -}}
{{- end -}}
<a href="{{ $url }}" download target="_blank">{{ i18n "commons.download.singular_name" }}</a>
{{- end -}}
{{ end }}
{{ partial "commons/download-link" (dict
"id" .Params.downloadable_summary
"title" (i18n "commons.download.singular_name")
"use_filename_for_a11y_title" true
) }}
</div>
</div>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment