acoeur/themes/acoeur/layouts/partials/ac_choices.html

45 lines
1.4 KiB
HTML

{{ $user := eq .Section "users" }}
{{ $values := (dict "choices" .Params.ac_choices "results" .Params.ac_choice_results) }}
<form class="ac_choices">
{{ range $index, $choice := $values.choices }}
{{ $text := $choice | markdownify | plainify }}
<div class="ac_choice">
<input id="elt_{{$index}}" name="ac_choice" required type="radio" value="{{$index}}" />
<label class="text" for="elt_{{$index}}">{{$text | htmlUnescape}}</label>
{{ if not $user }}
<div class="destination">
<label for="destination_{{$index}}"></label>
{{ with $.GetPage (substr (index (split $choice "]") 1) 1 -1) }}
<a class="gotoChoice" href="{{.RelPermalink}}"></a>
<input id="destination_{{$index}}"
list="pages"
name="destination"
type="text"
value="{{.Title}}" />
{{ end }}
<button class="delete" type="button">🗑</button>
</div>
{{ end }}
</div>
{{ end }}
{{ if not $user }}
<div class="ac_choice new_choice">
<input id="elt_" name="ac_choice" type="radio" />
<label class="text" for="elt_" placeholder="Nouveau choix..."></label>
<div class="destination">
<label for="destination_"></label>
<a class="gotoChoice"></a>
<input id="destination_" list="pages" placeholder="Destination" type="text" />
<button class="delete" type="button">🗑</button>
</div>
</div>
{{ end }}
</form>
{{ if not $user }}
<datalist id="pages"></datalist>
{{ end }}