BrainMinder/assets/templates/items/relations_view.tmpl
2024-12-27 17:33:16 +01:00

33 lines
799 B
Cheetah

{{define "item:relations_view"}}
{{ if (gt (len .relations) 0) }}
<fieldset style="margin-bottom: 40px">
<legend>Relations</legend>
<ul>
{{
range.relations
}}
{{ $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
}}
<li>
<a href="/item/view/{{ $target_id }}" hx-get="/item/view/{{ $target_id }}" hx-target="#modal-container"><i class="{{.Type_icon}}" title="{{.Type_title}}"></i> {{.Title}}</a>
</li>
{{
end
}}
</ul>
</fieldset>
{{ end }}
{{ end }}