mirror of
https://github.com/miniflux/v2.git
synced 2025-08-21 18:11:09 +00:00
feat(ui): avoid showing an excessive number of tags
This commit is contained in:
parent
f9dce3d10f
commit
a8bb7a48d7
23 changed files with 471 additions and 339 deletions
|
@ -100,8 +100,11 @@ func (f *funcMap) Map() template.FuncMap {
|
|||
"deRef": func(i *int) int { return *i },
|
||||
"duration": duration,
|
||||
"urlEncode": url.PathEscape,
|
||||
"subtract": func(a, b int) int {
|
||||
return a - b
|
||||
},
|
||||
|
||||
// These functions are overrode at runtime after the parsing.
|
||||
// These functions are overridden at runtime after parsing.
|
||||
"elapsed": func(timezone string, t time.Time) string {
|
||||
return ""
|
||||
},
|
||||
|
|
|
@ -136,13 +136,40 @@
|
|||
{{ if .entry.Tags }}
|
||||
<div class="entry-tags">
|
||||
{{ t "entry.tags.label" }}
|
||||
{{ range $i, $e := .entry.Tags }}
|
||||
{{if $i}}, {{end}}
|
||||
{{ if $.user }}
|
||||
<a href="{{ route "tagEntriesAll" "tagName" (urlEncode $e) }}"><strong>{{ $e }}</strong></a>
|
||||
{{ else }}
|
||||
<strong>{{ $e }}</strong>
|
||||
{{ $allTags := .entry.Tags }}
|
||||
{{ $numTags := len $allTags }}
|
||||
{{ $tagsLimit := 5 }}
|
||||
{{ $numerOfAdditionalTags := subtract $numTags $tagsLimit }}
|
||||
|
||||
<ul class="entry-tags-list">
|
||||
{{ range $i, $tagName := $allTags }}
|
||||
{{ if lt $i $tagsLimit }}
|
||||
{{ if $.user }}
|
||||
<li><a href="{{ route "tagEntriesAll" "tagName" (urlEncode $tagName) }}"><strong>{{ $tagName }}</strong></a></li>
|
||||
{{ else }}
|
||||
<li><strong>{{ $tagName }}</strong></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ if gt $numTags $tagsLimit }}
|
||||
<details class="entry-additional-tags">
|
||||
<summary>
|
||||
{{ plural "entry.tags.more_tags_label" $numerOfAdditionalTags $numerOfAdditionalTags }}
|
||||
</summary>
|
||||
<ul class="entry-tags-list">
|
||||
{{ range $idx, $tagName := $allTags }}
|
||||
{{ if ge $idx $tagsLimit }}
|
||||
{{ if $.user }}
|
||||
<li><a href="{{ route "tagEntriesAll" "tagName" (urlEncode $tagName) }}"><strong>{{ $tagName }}</strong></a></li>
|
||||
{{ else }}
|
||||
<li><strong>{{ $tagName }}</strong></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</details>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue