diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-05-07 11:09:37 +0200 |
---|---|---|
committer | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-05-07 11:09:37 +0200 |
commit | f54de6817ea320e6d92bea368123b2fb1395d95f (patch) | |
tree | 118e9a507a2fe10e6a71b33227fbbe513761ae73 /src/Wallabag | |
parent | dcd74397d64fbb9e25339d4d8f6564a91159917e (diff) | |
parent | d9926005b1195c8cb4607dd45c21c7ad6c4f4c80 (diff) | |
download | wallabag-f54de6817ea320e6d92bea368123b2fb1395d95f.tar.gz wallabag-f54de6817ea320e6d92bea368123b2fb1395d95f.tar.zst wallabag-f54de6817ea320e6d92bea368123b2fb1395d95f.zip |
Merge pull request #2020 from wallabag/fix-number-entries-per-tag
Fix number of entries in tag/list
Diffstat (limited to 'src/Wallabag')
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..b4adbbd3 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 getEntriesByUserId($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..524a1d23 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.getEntriesByUserId(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..d958c4b8 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.getEntriesByUserId(app.user.id) | length }})</li> |
13 | {% endfor %} | 13 | {% endfor %} |
14 | </ul> | 14 | </ul> |
15 | {% endblock %} | 15 | {% endblock %} |