Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{{ $only_file := .only_file | default false }}
{{ with .paper }}
{{ $modalId := printf "modal-%s" .Slug }}
<div class="paper-actions" role="group">
{{ if not $only_file }}
{{- if .Params.abstract -}}
<button class="squared-button" type="button" data-open-modal="{{ $modalId }}">{{ i18n "volumes.abstract" }}</button>
{{ partial "papers/modal.html"
(dict
"modalId" $modalId
"title" .Title
"abstract" .Params.abstract
) }}
{{- end -}}
{{- end -}}
{{- if .Params.pdf -}}
{{- $file := partial "GetMedia" .Params.pdf -}}
{{- $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)" $file.name $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) }}" class="squared-button">
<figcaption>
<abbr title="{{ i18n (printf "commons.extensions.%s" $extension) }}">{{ $extension }}</abbr>
- {{ $size.weight }} <abbr title="{{ $size.full_unit }}">{{ $size.unit }}</abbr>
</figcaption>
</a>
</figure>
{{ end }}
{{- end -}}
</div>
{{ end }}