BrainMinder/assets/templates/items/relations_view.tmpl

38 lines
874 B
Cheetah
Raw Normal View History

2024-08-22 10:13:16 +02:00
{{define "item:relations_view"}}
{{ if (gt (len .relations) 0) }}
<fieldset class="w3-round-large" style="margin-bottom: 40px">
<legend>Relations</legend>
<ul class="w3-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 }}