BrainMinder/assets/templates/items/add_relation.tmpl
2024-12-27 17:44:06 +01:00

34 lines
1.4 KiB
Cheetah

{{define "item:add_relation"}}
{{ $relation_name := printf "%s%v" "ItemRelation-New-" .relatedItem.Id }}
<tr id="{{$relation_name}}-Row">
<td class="no-label"><i class="{{.relatedItem.Type_icon}}"></i> {{.relatedItem.Type_title}} :
<a href="/item/view/{{.relatedItem.Id}}" hx-get="/item/view/{{.relatedItem.Id}}" hx-target="body" hx-swap="beforeend">{{.relatedItem.Title}}</a>
</td>
<td class="no-label">
{{ if gt (len .relatedItem.Categories) 0 }}
<i class="hide-medium hide-large bi bi-bookmark-star-fill"></i>
{{ range (stringToArray .relatedItem.Categories "|")}}
{{ $category_name := index $.categoriesMap .}}
<div class="tag" style="padding: 3px">
{{ $category_name }}
</div>
{{ end }}
{{ end }}
</td>
<td class="no-label">
{{ if gt (len .relatedItem.Tags) 0 }}
<i class="hide-medium hide-large bi bi-tags-fill"></i>
{{ range (stringToArray .relatedItem.Tags ",")}}
<div class="tag" style="padding: 3px">
{{ . }}
</div>
{{ end }}
{{ end }}
</td>
<td class="no-label">{{ widget_relation_type $relation_name "Link" `id="$relation_name"` }}</td>
<td class="no-label">
<a class="button delete" href="#" onclick="document.getElementById('{{$relation_name}}-Row').remove()"><i class="bi bi-link-45deg" title="Remove relation"></i><span>Remove</span></a>
</td>
</tr>
{{ end }}