2019-11-04 15:00:46 +01:00
|
|
|
{{define "relation_list"}}
|
|
|
|
|
|
|
|
{{$format := "html"}}
|
|
|
|
{{if .format}}
|
|
|
|
{{$format = .format}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
<h2 class="karmen-relation-header">{{$title := .options.title}}{{if .title}}{{$title = .title}}{{end}}{{$title}}</h2>
|
|
|
|
{{if (.data|isSlice)}}
|
|
|
|
|
|
|
|
{{if gt (len .data) 0}}
|
|
|
|
<div class="list-group" id="{{$title|toLower}}_list_group">
|
|
|
|
{{range $el := .data}}
|
|
|
|
<a href="{{show $.options.model $el.ID $format}}" class="list-group-item list-group-item-action">
|
|
|
|
<span class="{{$.options.icon}}"></span>
|
|
|
|
{{$el | string}}
|
|
|
|
{{if $.small}}
|
|
|
|
{{range $s := $.small}}
|
|
|
|
<div class="text-right">
|
2019-12-13 12:55:11 +01:00
|
|
|
{{if $.smallOptions}}
|
|
|
|
{{template "small" dict "options" ($.smallOptions | yaml) "data" ($el|field $s)}}
|
|
|
|
{{else}}
|
|
|
|
{{template "small" dict "data" ($el|field $s)}}
|
|
|
|
{{end}}
|
2019-11-04 15:00:46 +01:00
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{{else}}
|
|
|
|
<p>{{.noElements}}</p>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{else}}
|
|
|
|
|
|
|
|
{{if .data}}
|
|
|
|
<div class="list-group" id="{{$title|toLower}}_list_group">
|
|
|
|
|
|
|
|
<a href="{{.data.ID | show $.options.model}}" class="list-group-item list-group-item-action">
|
|
|
|
<span class="{{$.options.icon}}"></span>
|
|
|
|
{{.data | string}}
|
|
|
|
{{if .small}}
|
|
|
|
{{range $s := .small}}
|
|
|
|
<div class="text-right">
|
|
|
|
{{$options := `noElements: "nessun elemento"`}}
|
|
|
|
{{template "small" dict "options" ($options | yaml) "data" (.data|field $s)}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{else}}
|
|
|
|
<p>{{.noElements}}</p>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|