relation_list.html.tpl 1.4 KB

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