BrainMinder/assets/templates/items/all_list_rows.tmpl
2025-01-01 17:30:11 +01:00

52 lines
2.4 KiB
Cheetah

{{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="hide-xsmall" href="/item/view/{{.Id}}" hx-get="/item/view/{{.Id}}" hx-target="body" hx-swap="beforeend">{{.Title}}</a>
<a class="hide-medium 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="hide-xsmall" 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="hide-medium 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="hide-medium 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="operations" nowrap="nowrap">
{{ if eq .On_dashboard 1}}
{{ template "item:remove_from_dashboard" .Id }}
{{ else }}
{{ template "item:add_to_dashboard" .Id }}
{{ end }}
<button href="#" hx-target="body" hx-swap="beforeend" hx-get="/item/share/{{.Id}}" title="Share"><i class="bi bi-share-fill"></i></button>
<button hx-get="/item/update/{{.Id}}" hx-push-url="true" hx-target="#page-content" title="Edit"><i class="bi bi-pencil"></i></button>
<button hx-delete="/item/delete/{{.Id}}" hx-target="closest tr" hx-swap="outerHTML swap:1s" hx-trigger="confirmed" onClick="bm_show_confirm_delete(this, 'Items', 'Delete this item ?')" title="Delete"><i class="bi bi-trash"></i></button>
</td>
</tr>
{{ end }}
{{ end }}