Button: add option for target

This commit is contained in:
Tobias Bauer 2022-10-18 16:23:41 +02:00
parent 114e97f1f9
commit 13a5a34faa

View file

@ -2,6 +2,7 @@
{{- $content := .content }} {{- $content := .content }}
{{- $href := .href }} {{- $href := .href }}
{{- $style := .style | default "transparent" }} {{- $style := .style | default "transparent" }}
{{- $target := .target | default "_blank" }}
{{- $title := .title | default ($content) | default ($style | T) }} {{- $title := .title | default ($content) | default ($style | T) }}
{{- $icon := .icon | default "" }} {{- $icon := .icon | default "" }}
{{- if and (not $icon) (eq (len $icon) 0) }} {{- if and (not $icon) (eq (len $icon) 0) }}
@ -17,7 +18,7 @@
{{- $iconposition := .iconposition | default "left" }} {{- $iconposition := .iconposition | default "left" }}
{{- with $context }} {{- with $context }}
<span class="btn cstyle {{ $style }}"> <span class="btn cstyle {{ $style }}">
<a{{ if $href }} href="{{ $href }}" target="_blank"{{ end }}> <a{{ if $href }} href="{{ $href }}" target="{{ $target }}"{{ end }}>
{{- if and $icon (eq $iconposition "left") }} {{- if and $icon (eq $iconposition "left") }}
<i class="{{ $icon }}"></i> <i class="{{ $icon }}"></i>
{{- end }} {{- end }}