relation_list.html.tpl 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {{define "relation_list"}}
  2. <h2 class="karmen-relation-header">{{$title := .options.title}}{{if .title}}{{$title = .title}}{{end}}{{$title}}</h2>
  3. {{if (.data|isSlice)}}
  4. {{if gt (len .data) 0}}
  5. <div class="list-group" id="{{$title|toLower}}_list_group">
  6. {{range $el := .data}}
  7. <a href="{{$el.ID | show $.options.model}}" class="list-group-item list-group-item-action">
  8. <span class="{{$.options.icon}}"></span>
  9. {{$el | string}}
  10. {{if $.small}}
  11. {{range $s := $.small}}
  12. <div class="text-right">
  13. {{$options := `noElements: "nessun elemento"`}}
  14. {{template "small" dict "options" ($options | yaml) "data" ($el|field $s)}}
  15. </div>
  16. {{end}}
  17. {{end}}
  18. {{end}}
  19. </a>
  20. </div>
  21. {{else}}
  22. <p>{{.noElements}}</p>
  23. {{end}}
  24. {{else}}
  25. {{if .data}}
  26. <div class="list-group" id="{{$title|toLower}}_list_group">
  27. <a href="{{.data.ID | show $.options.model}}" class="list-group-item list-group-item-action">
  28. <span class="{{$.options.icon}}"></span>
  29. {{.data | string}}
  30. {{if .small}}
  31. {{range $s := .small}}
  32. <div class="text-right">
  33. {{$options := `noElements: "nessun elemento"`}}
  34. {{template "small" dict "options" ($options | yaml) "data" (.data|field $s)}}
  35. </div>
  36. {{end}}
  37. {{end}}
  38. </a>
  39. </div>
  40. {{else}}
  41. <p>{{.noElements}}</p>
  42. {{end}}
  43. {{end}}
  44. {{end}}