{{define "item:relations"}} {{ range .item.Relations}} {{ $relation_name := printf "%s%v-%v" "ItemRelation-" .Item_id .Related_item_id }} {{ $relation_name_remove := printf "%s%v-%v" "ItemRelation-ToRemove-" .Item_id .Related_item_id }} {{ end }}
Item Categories Tags Relation type
{{ $target_id := .Related_item_id}} {{ $relation_type := .Relation_type }} {{ if eq .Related_item_id $.item.Id }} {{ $target_id = .Item_id}} {{ if eq "Parent" .Relation_type}} {{ $relation_type = "Child" }} {{ else if eq "Child" .Relation_type}} {{ $relation_type = "Parent" }} {{ end }} {{ end }} {{.Title}} {{ if gt (len .Categories) 0 }} {{ range (stringToArray .Categories "|")}} {{ $category_name := index $.categoriesMap .}}
class="w3-button w3-round-large w3-hover-metro-dark-blue w3-medium" {{ $category_name }}
{{ end }} {{ end }}
{{ if gt (len .Tags) 0 }} {{ range (stringToArray .Tags ",")}}
{{ . }}
{{ end }} {{ end }}
{{ widget_relation_type $relation_name $relation_type `id="$relation_name" class=" w3-border"` }}
{{ end }}