numerus/web/template/contacts/index.gohtml

90 lines
3.5 KiB
Plaintext
Raw Normal View History

{{ define "title" -}}
2023-02-03 12:58:10 +00:00
{{( pgettext "Contacts" "title" )}}
{{- end }}
{{ define "breadcrumbs" -}}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.ContactsIndexPage*/ -}}
<nav data-hx-boost="true" data-hx-target="main">
<p>
2023-02-03 12:58:10 +00:00
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
<a>{{( pgettext "Contacts" "title" )}}</a>
</p>
<p>
{{ template "filters-toggle" }}
2023-02-03 12:58:10 +00:00
<a class="primary button"
href="{{ companyURI "/contacts/new" }}">{{( pgettext "New contact" "action" )}}</a>
</p>
</nav>
{{- end }}
{{ define "content" }}
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.ContactsIndexPage*/ -}}
<form class="filters" method="GET" action="{{ companyURI "/contacts"}}"
data-hx-target="main"
data-hx-boost="true"
data-hx-trigger="change,search,submit"
aria-labelledby="filters-toggle"
>
{{ with .Filters }}
{{ template "input-field" .Name }}
{{ template "tags-field" .Tags | addTagsAttr (print `data-conditions="` .TagsCondition.Name `-field"`) }}
{{ template "toggle-field" .TagsCondition }}
{{ end }}
<noscript>
<button type="submit">{{( pgettext "Filter" "action" )}}</button>
</noscript>
</form>
2023-02-03 12:58:10 +00:00
<table>
<thead>
<tr>
<th>{{( pgettext "Contact" "title" )}}</th>
2023-02-03 12:58:10 +00:00
<th>{{( pgettext "Email" "title" )}}</th>
<th>{{( pgettext "Phone" "title" )}}</th>
<th>{{( pgettext "Tags" "title" )}}</th>
<th>{{( pgettext "Actions" "title" )}}</th>
2023-02-03 12:58:10 +00:00
</tr>
</thead>
<tbody>
2023-02-03 12:58:10 +00:00
{{ with .Contacts }}
{{- range $contact := . }}
2023-02-03 12:58:10 +00:00
<tr>
<td><a href="{{ companyURI "/contacts/"}}{{ .Slug }}" data-hx-target="main"
data-hx-boost="true">{{ .Name }}</a></td>
2023-02-03 12:58:10 +00:00
<td><a href="mailto:{{ .Email }}">{{ .Email }}</a></td>
<td><a href="tel:{{ .Phone }}">{{ .Phone }}</a></td>
2023-05-12 09:32:39 +00:00
<td
data-hx-get="{{companyURI "/contacts/"}}{{ .Slug }}/tags/edit"
data-hx-target="this"
data-hx-swap="outerHTML"
>
{{- range $index, $tag := .Tags }}
{{- if gt $index 0 }}, {{ end -}}
2023-05-12 09:32:39 +00:00
{{ . }}
{{- end }}
</td>
<td class="actions">
<details class="menu">
<summary><i class="ri-more-line"></i></summary>
<ul role="menu" class="action-menu">
<li role="presentation">
<a role="menuitem" href="{{ companyURI "/contacts"}}/{{ .Slug }}"
data-hx-target="main" data-hx-boost="true"
>
<i class="ri-edit-line"></i>
{{( pgettext "Edit" "action" )}}
</a>
</li>
</ul>
</details>
</td>
2023-02-03 12:58:10 +00:00
</tr>
{{- end }}
{{ else }}
<tr>
<td colspan="5">{{( gettext "No contacts added yet." )}}</td>
2023-02-03 12:58:10 +00:00
</tr>
{{ end }}
</tbody>
</table>
{{- end }}