59 lines
1.4 KiB
Smarty
59 lines
1.4 KiB
Smarty
{{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">
|
|
{{if $.smallOptions}}
|
|
{{template "small" dict "options" ($.smallOptions | yaml) "data" ($el|field $s)}}
|
|
{{else}}
|
|
{{template "small" dict "data" ($el|field $s)}}
|
|
{{end}}
|
|
</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}}
|