98 lines
3.2 KiB
Cheetah
98 lines
3.2 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="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"
|
||
|
>{{.Title}}</a
|
||
|
>
|
||
|
</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_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="w3-hide-medium w3-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 w3-hide-medium w3-hide-large">{{.Title}} : </span>{{ $values_str }}
|
||
|
{{ end }}
|
||
|
</td>
|
||
|
{{end}}
|
||
|
<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-fill'></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 }}
|