BrainMinder/assets/templates/items/add_relation.tmpl
2024-08-22 10:13:16 +02:00

46 lines
1.6 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="#modal-container"
>{{.relatedItem.Title}}</a
>
</td>
<td class="no-label">
{{ if gt (len .relatedItem.Categories) 0 }}
<i class="w3-hide-medium w3-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="w3-hide-medium w3-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" class="w3-input w3-border"` }}</td>
<td class="no-label">
<div class="w3-bar">
<a
class="w3-right w3-btn w3-metro-dark-red w3-round-large"
href="#"
_="on click remove #{{$relation_name}}-Row"
><i class="bi bi-link-45deg" title="Remove relation"></i><span class="w3-hide-small"> Remove</span></a
>
</div>
</td>
</tr>
{{ end }}