diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-05-03 21:12:40 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-05-03 21:12:40 +0200 |
commit | 12c697562e11bed4d2c2af0521a67219dd62ee63 (patch) | |
tree | d5cf4549af9469e4bd5d701b6d5dbb0e70638585 /src | |
parent | 9b57bac8b9ad95d1b4de051222b0f351991997f0 (diff) | |
download | wallabag-12c697562e11bed4d2c2af0521a67219dd62ee63.tar.gz wallabag-12c697562e11bed4d2c2af0521a67219dd62ee63.tar.zst wallabag-12c697562e11bed4d2c2af0521a67219dd62ee63.zip |
Fix number of entries in tag/list
Fix #2006
Diffstat (limited to 'src')
3 files changed, 14 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index a6e2d023..f6c42f5d 100644 --- a/src/Wallabag/CoreBundle/Entity/Tag.php +++ b/src/Wallabag/CoreBundle/Entity/Tag.php | |||
@@ -117,4 +117,16 @@ class Tag | |||
117 | { | 117 | { |
118 | return $this->entries; | 118 | return $this->entries; |
119 | } | 119 | } |
120 | |||
121 | public function getEntriesByUser($userId) | ||
122 | { | ||
123 | $filteredEntries = new ArrayCollection(); | ||
124 | foreach ($this->entries as $entry) { | ||
125 | if ($entry->getUser()->getId() === $userId) { | ||
126 | $filteredEntries->add($entry); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | return $filteredEntries; | ||
131 | } | ||
120 | } | 132 | } |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig index bb0ca939..4df37174 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | <ul> | 10 | <ul> |
11 | {% for tag in tags %} | 11 | {% for tag in tags %} |
12 | <li id="tag-{{ tag.id|e }}">{{tag.label}} ({{ tag.entries.getValues | length }})</li> | 12 | <li id="tag-{{ tag.id|e }}">{{tag.label}} ({{ tag.getEntriesByUser(app.user.id) | length }})</li> |
13 | {% endfor %} | 13 | {% endfor %} |
14 | </ul> | 14 | </ul> |
15 | {% endblock %} | 15 | {% endblock %} |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig index 6fd263d8..c5b516f9 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig | |||
@@ -9,7 +9,7 @@ | |||
9 | <br /> | 9 | <br /> |
10 | <ul class="row data"> | 10 | <ul class="row data"> |
11 | {% for tag in tags %} | 11 | {% for tag in tags %} |
12 | <li id="tag-{{ tag.id|e }}" class="col l4 m6 s12">{{tag.label}} ({{ tag.entries.getValues | length }})</li> | 12 | <li id="tag-{{ tag.id|e }}" class="col l4 m6 s12">{{tag.label}} ({{ tag.getEntriesByUser(app.user.id) | length }})</li> |
13 | {% endfor %} | 13 | {% endfor %} |
14 | </ul> | 14 | </ul> |
15 | {% endblock %} | 15 | {% endblock %} |