1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- {{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">
- {{$options := `noElements: "nessun elemento"`}}
- {{template "small" dict "options" ($options | yaml) "data" ($el|field $s)}}
- </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}}
|