59 lines
2.7 KiB
Cheetah
59 lines
2.7 KiB
Cheetah
{{define "items:list_rows"}}
|
|
|
|
{{ $rowCount := 0 }}
|
|
|
|
{{ range .items }}
|
|
<tr
|
|
{{ $rowCount = incr $rowCount}}
|
|
{{ if eq $rowCount 10 }}
|
|
{{ $offset := addI $.offset $rowCount}}
|
|
hx-get="/items/type/{{$.type.Id}}?offset={{ $offset }}&out=rows&criteriaName={{ $.criteriaName }}"
|
|
hx-trigger="revealed"
|
|
hx-swap="afterend"
|
|
{{ end }}
|
|
>
|
|
<td class="title no-label" data-label="Title">
|
|
<a class="hide-small" 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">{{.Title}}</a>
|
|
</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_name := index $.categoriesMap .}}
|
|
<a hx-post="/items/type/{{$.type.Id}}" hx-target="#page-content" hx-push-url="true" href="#" hx-vals="{"category_id" : "{{ . }}"}">{{ $category_name }}</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/type/{{$.type.Id}}" hx-target="#page-content" hx-push-url="true" href="#" hx-vals="{"Tags" : "{{.}}"}">{{ . }}</a>
|
|
{{ end }}
|
|
{{ end }}
|
|
</td>
|
|
{{ $fieldsValuesMap := .FieldsValuesMap}}
|
|
{{ range $.Fields}}
|
|
<td class="no-label" data-label="{{.Title}}">
|
|
{{ $values_str := renderFieldValues (index $fieldsValuesMap .Type_field_id) .Widget }}
|
|
{{ if gt (len $values_str) 0 }}
|
|
<span class="field-label hide-medium hide-large">{{.Title}} : </span>{{ $values_str }}
|
|
{{ end }}
|
|
</td>
|
|
{{end}}
|
|
<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 }} |