BrainMinder/assets/templates/items/all_list_rows.tmpl

90 lines
2.9 KiB
Cheetah
Raw Normal View History

2024-08-22 10:13:16 +02:00
{{define "itemsAll:list_rows"}}
{{ $rowCount := 0 }}
{{ range .items }}
<tr
{{ $rowCount = incr $rowCount}}
{{ if eq $rowCount 10 }}
{{ $offset := addI $.offset $rowCount}}
hx-get="/items?offset={{ $offset }}&out=rows&criteriaName={{ $.criteriaName }}"
hx-trigger="revealed"
hx-swap="afterend"
{{ end }}
>
<td class="title no-label">
<a
class="w3-hide-small"
href="/item/view/{{.Id}}"
hx-get="/item/view/{{.Id}}"
hx-target="#modal-container"
>{{.Title}}</a
>
<a
class="w3-hide-medium w3-hide-large"
href="/item/read/{{.Id}}"
hx-get="/item/read/{{.Id}}"
hx-target="#page-content"
hx-push-url="true"
><i title="{{.Type_title}}" class="{{.Type_icon}}"></i> {{.Title}}</a
>
</td>
<td data-label="Type" class="w3-hide-small" nowrap="nowrap"><i class="{{.Type_icon}}"></i> {{.Type_title}}</td>
<td data-label="Categories" class="no-label links-list">
{{ if gt (len .Categories) 0 }}
<i class="w3-hide-medium w3-hide-large bi bi-tags-fill"></i>
{{ range (stringToArray .Categories "|")}}
{{ $category_id := index $.categoriesMap .}}
<a hx-post="/items" hx-target="#page-content" hx-push-url="true" href="#" hx-vals="{&quot;category_id&quot; : &quot;{{ . }}&quot;}">{{ $category_id }}</a>
{{ end }}
{{ end }}
</td>
<td data-label="Tags" class="no-label links-list">
{{ if gt (len .Tags) 0 }}
<i class="w3-hide-medium w3-hide-large bi bi-tags"></i>
{{ range (stringToArray .Tags ",")}}
<a hx-post="/items" hx-target="#page-content"
hx-push-url="true" href="#" hx-vals="{&quot;Tags&quot; : &quot;{{.}}&quot;}">{{ . }}</a>
{{ end }}
{{ end }}
</td>
<td data-label="" class="w3-right-align" nowrap="nowrap">
{{ if eq .On_dashboard 1}}
{{ template "item:remove_from_dashboard" .Id }}
{{ else }}
{{ template "item:add_to_dashboard" .Id }}
{{ end }}
<button
class="w3-button w3-edit w3-small w3-border w3-round-large"
hx-target="#modal-container"
hx-get="/item/share/{{.Id}}"
title="Share">
<i class='bi bi-share'></i>
</button>
<button
class="w3-button w3-edit w3-small w3-border w3-round-large"
hx-get="/item/update/{{.Id}}"
hx-push-url="true"
hx-target="#page-content"
title="Edit">
<i class="bi bi-pencil"></i>
</button>
<button
class="w3-button w3-delete w3-small w3-border w3-round-large"
hx-delete="/item/delete/{{.Id}}"
hx-target="closest tr"
hx-swap="outerHTML swap:1s"
hx-trigger="confirmed"
onClick="bm_show_confirm(this, 'Items', 'Delete this item ?')"
title="Delete">
<i class="bi bi-trash"></i>
</button>
</td>
</tr>
{{ end }}
{{ end }}