aboutsummaryrefslogtreecommitdiff
path: root/internal/template/templates/views/categories.html
blob: 9856207dff6a515fbda0a8c376e1cb9245738b57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{{ define "title"}}{{ t "page.categories.title" }} ({{ .total }}){{ end }}

{{ define "page_header"}}
<section class="page-header" aria-labelledby="page-header-title page-header-title-count">
    <h1 id="page-header-title" dir="auto">
        {{ t "page.categories.title" }}
        <span aria-hidden="true"> ({{ .total }})</span>
    </h1>
    <span id="page-header-title-count" class="sr-only">{{ plural "page.categories_count" .total .total }}</span>
    <nav aria-label="{{ t "page.categories.title" }} {{ t "menu.title" }}">
        <ul>
            <li>
                <a href="{{ route "createCategory" }}">{{ icon "add-category" }}{{ t "menu.create_category" }}</a>
            </li>
        </ul>
    </nav>
</section>
{{ end }}

{{ define "content"}}
{{ if not .categories }}
    <p class="alert alert-error">{{ t "alert.no_category" }}</p>
{{ else }}
    <div class="items">
        {{ range .categories }}
        <article
            class="item category-item {{if gt (deRef .TotalUnread) 0 }} category-has-unread{{end}}"
            aria-labelledby="category-title-{{ .ID }}"
        >
            <header id="category-title-{{ .ID }}"  class="item-header" dir="auto">
                <h2 class="item-title">
                    <a href="{{ route "categoryEntries" "categoryID" .ID }}" aria-label="{{ .Title }}, {{ t "page.categories.unread_counter" }}: {{ .TotalUnread }}">
                        {{ .Title }}
                        <span class="category-item-total" aria-hidden="true">
                            (<span class="sr-only">{{ t "page.categories.unread_counter" }}: </span>{{ .TotalUnread }})
                        </span>
                    </a>

                </h2>
            </header>
            <div class="item-meta">
                <ul class="item-meta-info">
                    <li class="item-meta-info-feed-count">
                        {{ if eq (deRef .FeedCount) 0 }}{{ t "page.categories.no_feed" }}{{ else }}{{ plural "page.categories.feed_count" (deRef .FeedCount) (deRef .FeedCount) }}{{ end }}
                    </li>
                </ul>
                <ul class="item-meta-icons">
                    <li class="item-meta-icons-entries">
                        <a href="{{ route "categoryEntries" "categoryID" .ID }}">{{ icon "entries" }}<span class="icon-label">{{ t "page.categories.entries" }}</span></a>
                    </li>
                    <li class="item-meta-icons-feeds">
                        <a href="{{ route "categoryFeeds" "categoryID" .ID }}">{{ icon "feeds" }}<span class="icon-label">{{ t "page.categories.feeds" }}</span></a>
                    </li>
                    <li class="item-meta-icons-edit">
                        <a href="{{ route "editCategory" "categoryID" .ID }}">{{ icon "edit" }}<span class="icon-label">{{ t "menu.edit_category" }}</span></a>
                    </li>
                    {{ if eq (deRef .FeedCount) 0 }}
                    <li class="item-meta-icons-delete">
                        <a href="#"
                            role="button"
                            aria-describedby="category-title-{{ .ID }}"
                            data-confirm="true"
                            data-label-question="{{ t "confirm.question" }}"
                            data-label-yes="{{ t "confirm.yes" }}"
                            data-label-no="{{ t "confirm.no" }}"
                            data-label-loading="{{ t "confirm.loading" }}"
                            data-url="{{ route "removeCategory" "categoryID" .ID }}">{{ icon "delete" }}<span class="icon-label">{{ t "action.remove" }}</span></a>
                    </li>
                    {{ end }}
                    {{ if gt (deRef .TotalUnread) 0 }}
                      <li class="item-meta-icons-mark-as-read">
                        <a href="#"
                            role="button"
                            aria-describedby="category-title-{{ .ID }}"
                            data-confirm="true"
                            data-label-question="{{ t "confirm.question" }}"
                            data-label-yes="{{ t "confirm.yes" }}"
                            data-label-no="{{ t "confirm.no" }}"
                            data-label-loading="{{ t "confirm.loading" }}"
                            data-url="{{ route "markCategoryAsRead" "categoryID" .ID }}">{{ icon "read" }}<span class="icon-label">{{ t "menu.mark_all_as_read" }}</span></a>
                      </li>
                    {{ end }}
                </ul>
            </div>
        </article>
        {{ end }}
    </div>
{{ end }}

{{ end }}