aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/Resources/static/themes/material/css/sidenav.scss4
-rw-r--r--app/Resources/static/themes/material/css/various.scss6
-rwxr-xr-xapp/Resources/static/themes/material/index.js12
-rw-r--r--app/Resources/static/themes/material/js/tools.js9
-rw-r--r--src/Wallabag/CoreBundle/Controller/NotificationsController.php38
-rw-r--r--src/Wallabag/CoreBundle/Entity/Notification.php220
-rw-r--r--src/Wallabag/CoreBundle/Notifications/Action.php84
-rw-r--r--src/Wallabag/CoreBundle/Notifications/ActionInterface.php41
-rw-r--r--src/Wallabag/CoreBundle/Notifications/NotificationInterface.php66
-rw-r--r--src/Wallabag/CoreBundle/Repository/NotificationRepository.php17
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/common/Developer/client.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/common/Developer/index.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/common/Static/about.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/common/Static/howto.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/common/Static/quickstart.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Notification/notifications.html.twig42
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig45
-rw-r--r--src/Wallabag/CoreBundle/Twig/WallabagExtension.php10
-rw-r--r--src/Wallabag/UserBundle/Entity/User.php21
-rw-r--r--src/Wallabag/UserBundle/Resources/views/manage.html.twig2
35 files changed, 718 insertions, 7 deletions
diff --git a/app/Resources/static/themes/material/css/sidenav.scss b/app/Resources/static/themes/material/css/sidenav.scss
index 416dc1c7..f45970de 100644
--- a/app/Resources/static/themes/material/css/sidenav.scss
+++ b/app/Resources/static/themes/material/css/sidenav.scss
@@ -36,6 +36,10 @@
36 } 36 }
37} 37}
38 38
39#notifications {
40 width: 300px;
41}
42
39.bold > a { 43.bold > a {
40 font-weight: bold; 44 font-weight: bold;
41} 45}
diff --git a/app/Resources/static/themes/material/css/various.scss b/app/Resources/static/themes/material/css/various.scss
index 7daf40ec..300015ab 100644
--- a/app/Resources/static/themes/material/css/various.scss
+++ b/app/Resources/static/themes/material/css/various.scss
@@ -30,3 +30,9 @@ nav .input-field input {
30.tab { 30.tab {
31 flex: 1; 31 flex: 1;
32} 32}
33
34#notifications-count {
35 position: relative;
36 top: -50px;
37 left: 15px;
38}
diff --git a/app/Resources/static/themes/material/index.js b/app/Resources/static/themes/material/index.js
index d6afbb8a..e16749f6 100755
--- a/app/Resources/static/themes/material/index.js
+++ b/app/Resources/static/themes/material/index.js
@@ -8,7 +8,7 @@ import 'materialize-css/dist/js/materialize';
8import '../_global/index'; 8import '../_global/index';
9 9
10/* Tools */ 10/* Tools */
11import { initExport, initFilters } from './js/tools'; 11import { initExport, initFilters, initNotifications } from './js/tools';
12 12
13/* Import shortcuts */ 13/* Import shortcuts */
14import './js/shortcuts/main'; 14import './js/shortcuts/main';
@@ -34,6 +34,7 @@ $(document).ready(() => {
34 }); 34 });
35 initFilters(); 35 initFilters();
36 initExport(); 36 initExport();
37 initNotifications();
37 38
38 $('#nav-btn-add-tag').on('click', () => { 39 $('#nav-btn-add-tag').on('click', () => {
39 $('.nav-panel-add-tag').toggle(100); 40 $('.nav-panel-add-tag').toggle(100);
@@ -75,4 +76,13 @@ $(document).ready(() => {
75 const scrollPercent = (s / (d - c)) * 100; 76 const scrollPercent = (s / (d - c)) * 100;
76 $('.progress .determinate').css('width', `${scrollPercent}%`); 77 $('.progress .determinate').css('width', `${scrollPercent}%`);
77 }); 78 });
79
80 $('.notification').on('click', () => {
81 $.ajax({
82 url: Routing.generate('notification-archive-all'),
83 method: 'GET',
84 }).done(() => {
85 $('#notifications').sideNav('hide');
86 });
87 });
78}); 88});
diff --git a/app/Resources/static/themes/material/js/tools.js b/app/Resources/static/themes/material/js/tools.js
index 39398fd8..492640a0 100644
--- a/app/Resources/static/themes/material/js/tools.js
+++ b/app/Resources/static/themes/material/js/tools.js
@@ -21,4 +21,11 @@ function initExport() {
21 } 21 }
22} 22}
23 23
24export { initExport, initFilters }; 24function initNotifications() {
25 if ($('div').is('#notifications')) {
26 $('#button_notifications').show();
27 $('.js-notifications-action').sideNav({ edge: 'right' });
28 }
29}
30
31export { initExport, initFilters, initNotifications };
diff --git a/src/Wallabag/CoreBundle/Controller/NotificationsController.php b/src/Wallabag/CoreBundle/Controller/NotificationsController.php
new file mode 100644
index 00000000..24870b37
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Controller/NotificationsController.php
@@ -0,0 +1,38 @@
1<?php
2
3namespace Wallabag\CoreBundle\Controller;
4
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Symfony\Component\HttpFoundation\Request;
8use Symfony\Component\HttpFoundation\Response;
9
10class NotificationsController extends Controller
11{
12 /**
13 * @param Request $request
14 *
15 * @Route("/notifications", name="notifications-all")
16 *
17 * @return \Symfony\Component\HttpFoundation\Response
18 */
19 public function getAllNotificationsAction(Request $request)
20 {
21 $notifications = $this->getDoctrine()->getRepository('WallabagCoreBundle:Notification')->findByUser($this->getUser());
22
23 return $this->render('WallabagCoreBundle:Notification:notifications.html.twig', ['notifications' => $notifications]);
24 }
25
26 /**
27 * @Route("/notifications/readall", name="notification-archive-all")
28 *
29 * @param Request $request
30 * @return Response
31 */
32 public function markAllNotificationsAsReadAction(Request $request)
33 {
34 $this->getDoctrine()->getRepository('WallabagCoreBundle:Notification')->markAllAsReadForUser($this->getUser()->getId());
35
36 return $this->redirectToRoute('notifications-all');
37 }
38}
diff --git a/src/Wallabag/CoreBundle/Entity/Notification.php b/src/Wallabag/CoreBundle/Entity/Notification.php
new file mode 100644
index 00000000..e1c1b449
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/Notification.php
@@ -0,0 +1,220 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\Common\Collections\ArrayCollection;
6use Doctrine\ORM\Mapping as ORM;
7use Psr\Log\LoggerInterface;
8use Psr\Log\NullLogger;
9use Wallabag\CoreBundle\Notifications\ActionInterface;
10use Wallabag\CoreBundle\Notifications\NotificationInterface;
11use Wallabag\UserBundle\Entity\User;
12
13/**
14 * Class Notification
15 *
16 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\NotificationRepository")
17 * @ORM\Table(name="`notification`")
18 */
19class Notification implements NotificationInterface {
20
21 /**
22 * @var int
23 *
24 * @ORM\Column(name="id", type="integer")
25 * @ORM\Id
26 * @ORM\GeneratedValue(strategy="AUTO")
27 *
28 */
29 protected $id;
30
31 /**
32 * @var int $type
33 *
34 * @ORM\Column(name="type", type="integer")
35 */
36 protected $type;
37
38 /**
39 * @var User $user
40 *
41 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="notifications")
42 */
43 protected $user;
44
45 /**
46 * @var \DateTime $timestamp
47 *
48 * @ORM\Column(name="timestamp", type="datetime")
49 */
50 protected $timestamp;
51
52 /**
53 * @var string $title
54 *
55 * @ORM\Column(name="title", type="string")
56 */
57 protected $title;
58
59 /**
60 * @var boolean $read
61 *
62 * @ORM\Column(name="read", type="boolean")
63 */
64 protected $read;
65
66 protected $logger;
67
68 /**
69 * @var ArrayCollection<ActionInterface>
70 *
71 * @ORM\Column(name="actions", type="array", nullable=true)
72 */
73 protected $actions;
74
75 protected $actionTypes = [];
76
77 const TYPE_ADMIN = 0;
78 const TYPE_USER = 1;
79 const TYPE_RELEASE = 2;
80
81 public function __construct(User $user = null)
82 {
83 $this->logger = new NullLogger();
84 $this->timestamp = new \DateTime();
85 $this->actions = new ArrayCollection();
86 $this->read = false;
87 $this->user = $user;
88 }
89
90 /**
91 * @param LoggerInterface $logger
92 * @return NotificationInterface
93 */
94 public function setLogger(LoggerInterface $logger)
95 {
96 $this->logger = $logger;
97 return $this;
98 }
99
100 /**
101 * @return mixed
102 */
103 public function getId()
104 {
105 return $this->id;
106 }
107
108 /**
109 * @return mixed
110 */
111 public function getType()
112 {
113 return $this->type;
114 }
115
116 /**
117 * @param mixed $type
118 * @return NotificationInterface
119 */
120 public function setType($type)
121 {
122 $this->type = $type;
123 return $this;
124 }
125
126 /**
127 * @return User
128 */
129 public function getUser()
130 {
131 return $this->user;
132 }
133
134 /**
135 * @param User $user
136 * @return NotificationInterface
137 */
138 public function setUser(User $user)
139 {
140 $this->user = $user;
141 return $this;
142 }
143
144 /**
145 * @return \DateTime
146 */
147 public function getTimestamp()
148 {
149 return $this->timestamp;
150 }
151
152 /**
153 * @param \DateTime $timestamp
154 * @return NotificationInterface
155 */
156 public function setTimestamp(\DateTime $timestamp)
157 {
158 $this->timestamp = $timestamp;
159 return $this;
160 }
161
162 /**
163 * @return string
164 */
165 public function getTitle()
166 {
167 return $this->title;
168 }
169
170 /**
171 * @param string $title
172 * @return NotificationInterface
173 */
174 public function setTitle($title)
175 {
176 $this->title = $title;
177 return $this;
178 }
179
180 /**
181 * @return bool
182 */
183 public function isRead()
184 {
185 return $this->read;
186 }
187
188 /**
189 * @param bool $read
190 * @return NotificationInterface
191 */
192 public function setRead($read)
193 {
194 $this->read = $read;
195 return $this;
196 }
197
198 /**
199 * @param ActionInterface $action
200 * @return NotificationInterface
201 * @throws \InvalidArgumentException
202 */
203 public function addAction(ActionInterface $action)
204 {
205 if (isset($this->actionTypes[$action->getType()])) {
206 throw new \InvalidArgumentException('The notification already has a primary action');
207 }
208 $this->actionTypes[$action->getType()] = true;
209 $this->actions->add($action);
210 return $this;
211 }
212
213 /**
214 * @return ArrayCollection<ActionInterface>
215 */
216 public function getActions()
217 {
218 return $this->actions;
219 }
220}
diff --git a/src/Wallabag/CoreBundle/Notifications/Action.php b/src/Wallabag/CoreBundle/Notifications/Action.php
new file mode 100644
index 00000000..8ef1860a
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Notifications/Action.php
@@ -0,0 +1,84 @@
1<?php
2
3namespace Wallabag\CoreBundle\Notifications;
4
5class Action implements ActionInterface {
6
7 /**
8 * @var string
9 */
10 protected $label;
11
12 /**
13 * @var int
14 */
15 protected $type;
16
17 const TYPE_OK = 1;
18 const TYPE_YES = 2;
19 const TYPE_NO = 3;
20 const TYPE_INFO = 4;
21
22 /**
23 * @var string
24 */
25 protected $link;
26
27 /**
28 * @return string
29 */
30 public function getLabel()
31 {
32 return $this->label;
33 }
34
35 /**
36 * @param string $label
37 * @return ActionInterface
38 */
39 public function setLabel($label)
40 {
41 $this->label = $label;
42 return $this;
43 }
44
45 /**
46 * @return int
47 */
48 public function getType()
49 {
50 return $this->type;
51 }
52
53 /**
54 * @param int $type
55 * @return ActionInterface
56 * @throws \InvalidArgumentException
57 */
58 public function setType($type)
59 {
60 if ($type <= 0 || $type > 4) {
61 throw new \InvalidArgumentException('The given type option is invalid');
62 }
63 $this->type = $type;
64 return $this;
65 }
66
67 /**
68 * @return string
69 */
70 public function getLink()
71 {
72 return $this->link;
73 }
74
75 /**
76 * @param string $link
77 * @return ActionInterface
78 */
79 public function setLink($link)
80 {
81 $this->link = $link;
82 return $this;
83 }
84}
diff --git a/src/Wallabag/CoreBundle/Notifications/ActionInterface.php b/src/Wallabag/CoreBundle/Notifications/ActionInterface.php
new file mode 100644
index 00000000..0b40237d
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Notifications/ActionInterface.php
@@ -0,0 +1,41 @@
1<?php
2
3namespace Wallabag\CoreBundle\Notifications;
4
5interface ActionInterface {
6
7 /**
8 * @return string
9 */
10 public function getLabel();
11
12 /**
13 * @param string $label
14 * @return ActionInterface
15 */
16 public function setLabel($label);
17
18 /**
19 * @return int
20 */
21 public function getType();
22
23 /**
24 * @param int $type
25 * @return ActionInterface
26 */
27 public function setType($type);
28
29 /**
30 * @return string
31 */
32 public function getLink();
33
34 /**
35 * @param string $link
36 * @return ActionInterface
37 */
38 public function setLink($link);
39
40
41}
diff --git a/src/Wallabag/CoreBundle/Notifications/NotificationInterface.php b/src/Wallabag/CoreBundle/Notifications/NotificationInterface.php
new file mode 100644
index 00000000..d83e2361
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Notifications/NotificationInterface.php
@@ -0,0 +1,66 @@
1<?php
2
3namespace Wallabag\CoreBundle\Notifications;
4
5use Psr\Log\LoggerAwareInterface;
6
7interface NotificationInterface extends LoggerAwareInterface {
8
9 /**
10 * Title of the notification
11 *
12 * @return string
13 */
14 public function getTitle();
15
16 /**
17 * @param string $title
18 * @return NotificationInterface
19 */
20 public function setTitle($title);
21
22 /**
23 * Type of the notification.
24 *
25 * @return string
26 */
27 public function getType();
28
29 /**
30 * @param int $type
31 * @return NotificationInterface
32 */
33 public function setType($type);
34
35 /**
36 * If the notification has been viewed / dismissed or not
37 *
38 * @return boolean
39 */
40 public function isRead();
41
42 /**
43 * @param boolean $read
44 * @return NotificationInterface
45 */
46 public function setRead($read);
47
48 /**
49 * When the notification was sent
50 *
51 * @return \DateTime
52 */
53 public function getTimestamp();
54
55 /**
56 * @param \DateTime $timestamp
57 * @return NotificationInterface
58 */
59 public function setTimestamp(\DateTime $timestamp);
60
61 /**
62 * @param ActionInterface $action
63 * @return NotificationInterface
64 */
65 public function addAction(ActionInterface $action);
66}
diff --git a/src/Wallabag/CoreBundle/Repository/NotificationRepository.php b/src/Wallabag/CoreBundle/Repository/NotificationRepository.php
new file mode 100644
index 00000000..eb8dbb3e
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Repository/NotificationRepository.php
@@ -0,0 +1,17 @@
1<?php
2
3namespace Wallabag\CoreBundle\Repository;
4
5use Doctrine\ORM\EntityRepository;
6
7class NotificationRepository extends EntityRepository {
8
9 public function markAllAsReadForUser($userId) {
10 return $this->getEntityManager()->createQueryBuilder()
11 ->update('WallabagCoreBundle:Notification', 'n')
12 ->set('n.read', true)
13 ->where('n.user = :userId')->setParameter('userId', $userId)
14 ->getQuery()
15 ->getResult();
16 }
17}
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index 1bd0b8fd..4cfbd9ac 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -37,6 +37,7 @@ menu:
37 search: 'Søg' 37 search: 'Søg'
38 filter_entries: 'Filtrer artikler' 38 filter_entries: 'Filtrer artikler'
39 # export: 'Export' 39 # export: 'Export'
40 # notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: 'Indtast søgning' 42 input_label: 'Indtast søgning'
42 43
@@ -241,6 +242,13 @@ entry:
241 public: 242 public:
242 # shared_by_wallabag: "This article has been shared by <a href=%wallabag_instance%'>wallabag</a>" 243 # shared_by_wallabag: "This article has been shared by <a href=%wallabag_instance%'>wallabag</a>"
243 244
245# notifications:
246# sidebar:
247# view_more: 'View more'
248# list:
249# page_title: 'Notifications'
250# mark_all_as_read: 'Mark all as read'
251
244about: 252about:
245 page_title: 'Om' 253 page_title: 'Om'
246 top_menu: 254 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index 94bb3295..4874980e 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -37,6 +37,7 @@ menu:
37 search: 'Suche' 37 search: 'Suche'
38 filter_entries: 'Artikel filtern' 38 filter_entries: 'Artikel filtern'
39 export: 'Exportieren' 39 export: 'Exportieren'
40 # notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: 'Suchbegriff hier eingeben' 42 input_label: 'Suchbegriff hier eingeben'
42 43
@@ -242,6 +243,13 @@ entry:
242 public: 243 public:
243 shared_by_wallabag: "Dieser Artikel wurde mittels <a href='%wallabag_instance%'>wallabag</a> geteilt" 244 shared_by_wallabag: "Dieser Artikel wurde mittels <a href='%wallabag_instance%'>wallabag</a> geteilt"
244 245
246# notifications:
247# sidebar:
248# view_more: 'View more'
249# list:
250# page_title: 'Notifications'
251# mark_all_as_read: 'Mark all as read'
252
245about: 253about:
246 page_title: 'Über' 254 page_title: 'Über'
247 top_menu: 255 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 3a006a0e..308878f4 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -37,6 +37,7 @@ menu:
37 search: 'Search' 37 search: 'Search'
38 filter_entries: 'Filter entries' 38 filter_entries: 'Filter entries'
39 export: 'Export' 39 export: 'Export'
40 notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: 'Enter your search here' 42 input_label: 'Enter your search here'
42 43
@@ -242,6 +243,13 @@ entry:
242 public: 243 public:
243 shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" 244 shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
244 245
246notifications:
247 sidebar:
248 view_more: 'View more'
249 list:
250 page_title: 'Notifications'
251 mark_all_as_read: 'Mark all as read'
252
245about: 253about:
246 page_title: 'About' 254 page_title: 'About'
247 top_menu: 255 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index ca5d9b2c..e669268c 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -37,6 +37,7 @@ menu:
37 search: 'Buscar' 37 search: 'Buscar'
38 filter_entries: 'Filtrar los artículos' 38 filter_entries: 'Filtrar los artículos'
39 export: 'Exportar' 39 export: 'Exportar'
40 # notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: 'Introduzca su búsqueda aquí' 42 input_label: 'Introduzca su búsqueda aquí'
42 43
@@ -242,6 +243,13 @@ entry:
242 public: 243 public:
243 shared_by_wallabag: "Este artículo se ha compartido con <a href='%wallabag_instance%'>wallabag</a>" 244 shared_by_wallabag: "Este artículo se ha compartido con <a href='%wallabag_instance%'>wallabag</a>"
244 245
246# notifications:
247# sidebar:
248# view_more: 'View more'
249# list:
250# page_title: 'Notifications'
251# mark_all_as_read: 'Mark all as read'
252
245about: 253about:
246 page_title: 'Acerca de' 254 page_title: 'Acerca de'
247 top_menu: 255 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index ecd8f64d..0b4d7726 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -37,6 +37,7 @@ menu:
37 search: 'جستجو' 37 search: 'جستجو'
38 filter_entries: 'فیلترکردن مقاله‌ها' 38 filter_entries: 'فیلترکردن مقاله‌ها'
39 export: 'برون‌بری' 39 export: 'برون‌بری'
40 # notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: 'جستجوی خود را این‌جا بنویسید:' 42 input_label: 'جستجوی خود را این‌جا بنویسید:'
42 43
@@ -242,6 +243,13 @@ entry:
242 public: 243 public:
243 # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" 244 # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
244 245
246# notifications:
247# sidebar:
248# view_more: 'View more'
249# list:
250# page_title: 'Notifications'
251# mark_all_as_read: 'Mark all as read'
252
245about: 253about:
246 page_title: 'درباره' 254 page_title: 'درباره'
247 top_menu: 255 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 84706459..660f4d85 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -37,6 +37,7 @@ menu:
37 search: "Rechercher" 37 search: "Rechercher"
38 filter_entries: "Filtrer les articles" 38 filter_entries: "Filtrer les articles"
39 export: "Exporter" 39 export: "Exporter"
40 notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: "Saisissez votre terme de recherche" 42 input_label: "Saisissez votre terme de recherche"
42 43
@@ -242,6 +243,13 @@ entry:
242 public: 243 public:
243 shared_by_wallabag: "Cet article a été partagé par <a href=\"%wallabag_instance%\">wallabag</a>" 244 shared_by_wallabag: "Cet article a été partagé par <a href=\"%wallabag_instance%\">wallabag</a>"
244 245
246notifications:
247 sidebar:
248 view_more: 'Voir plus'
249 list:
250 page_title: 'Notifications'
251 mark_all_as_read: 'Marquer tout comme lu'
252
245about: 253about:
246 page_title: "À propos" 254 page_title: "À propos"
247 top_menu: 255 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index a8baa96f..56ff5bc0 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -37,6 +37,7 @@ menu:
37 search: 'Cerca' 37 search: 'Cerca'
38 filter_entries: 'Filtra contenuti' 38 filter_entries: 'Filtra contenuti'
39 export: 'Esporta' 39 export: 'Esporta'
40 # notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: 'Inserisci qui la tua ricerca' 42 input_label: 'Inserisci qui la tua ricerca'
42 43
@@ -242,6 +243,13 @@ entry:
242 public: 243 public:
243 # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" 244 # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
244 245
246# notifications:
247# sidebar:
248# view_more: 'View more'
249# list:
250# page_title: 'Notifications'
251# mark_all_as_read: 'Mark all as read'
252
245about: 253about:
246 page_title: 'About' 254 page_title: 'About'
247 top_menu: 255 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 8f39ce05..219478bc 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -37,6 +37,7 @@ menu:
37 search: 'Cercar' 37 search: 'Cercar'
38 filter_entries: 'Filtrar los articles' 38 filter_entries: 'Filtrar los articles'
39 export: 'Exportar' 39 export: 'Exportar'
40 # notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: 'Picatz vòstre mot-clau a cercar aquí' 42 input_label: 'Picatz vòstre mot-clau a cercar aquí'
42 43
@@ -242,6 +243,13 @@ entry:
242 public: 243 public:
243 shared_by_wallabag: "Aqueste article es estat partejat per <a href='%wallabag_instance%'>wallabag</a>" 244 shared_by_wallabag: "Aqueste article es estat partejat per <a href='%wallabag_instance%'>wallabag</a>"
244 245
246# notifications:
247# sidebar:
248# view_more: 'View more'
249# list:
250# page_title: 'Notifications'
251# mark_all_as_read: 'Mark all as read'
252
245about: 253about:
246 page_title: 'A prepaus' 254 page_title: 'A prepaus'
247 top_menu: 255 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index a6e0c10f..3662f9ab 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -37,6 +37,7 @@ menu:
37 search: 'Szukaj' 37 search: 'Szukaj'
38 filter_entries: 'Filtruj wpisy' 38 filter_entries: 'Filtruj wpisy'
39 export: 'Eksportuj' 39 export: 'Eksportuj'
40 # notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: 'Wpisz swoje zapytanie tutaj' 42 input_label: 'Wpisz swoje zapytanie tutaj'
42 43
@@ -242,6 +243,13 @@ entry:
242 public: 243 public:
243 shared_by_wallabag: "Ten artykuł został udostępniony przez <a href='%wallabag_instance%'>wallabag</a>" 244 shared_by_wallabag: "Ten artykuł został udostępniony przez <a href='%wallabag_instance%'>wallabag</a>"
244 245
246# notifications:
247# sidebar:
248# view_more: 'View more'
249# list:
250# page_title: 'Notifications'
251# mark_all_as_read: 'Mark all as read'
252
245about: 253about:
246 page_title: 'O nas' 254 page_title: 'O nas'
247 top_menu: 255 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
index a9473591..fa504617 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
@@ -37,6 +37,7 @@ menu:
37 search: 'Pesquisa' 37 search: 'Pesquisa'
38 filter_entries: 'Filtrar entradas' 38 filter_entries: 'Filtrar entradas'
39 export: 'Exportar' 39 export: 'Exportar'
40 # notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: 'Digite aqui sua pesquisa' 42 input_label: 'Digite aqui sua pesquisa'
42 43
@@ -242,6 +243,13 @@ entry:
242 public: 243 public:
243 shared_by_wallabag: "Este artigo foi compartilhado pelo <a href='%wallabag_instance%'>wallabag</a>" 244 shared_by_wallabag: "Este artigo foi compartilhado pelo <a href='%wallabag_instance%'>wallabag</a>"
244 245
246# notifications:
247# sidebar:
248# view_more: 'View more'
249# list:
250# page_title: 'Notifications'
251# mark_all_as_read: 'Mark all as read'
252
245about: 253about:
246 page_title: 'Sobre' 254 page_title: 'Sobre'
247 top_menu: 255 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 80d78a01..c5ecedc1 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -37,6 +37,7 @@ menu:
37 search: 'Căutare' 37 search: 'Căutare'
38 filter_entries: 'Filtrează articolele' 38 filter_entries: 'Filtrează articolele'
39 # export: 'Export' 39 # export: 'Export'
40 # notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: 'Introdu căutarea ta' 42 input_label: 'Introdu căutarea ta'
42 43
@@ -242,6 +243,13 @@ entry:
242 public: 243 public:
243 # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" 244 # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
244 245
246# notifications:
247# sidebar:
248# view_more: 'View more'
249# list:
250# page_title: 'Notifications'
251# mark_all_as_read: 'Mark all as read'
252
245about: 253about:
246 page_title: 'Despre' 254 page_title: 'Despre'
247 top_menu: 255 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 2896c823..62d58428 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -37,6 +37,7 @@ menu:
37 search: 'Ara' 37 search: 'Ara'
38 filter_entries: 'Filtrele' 38 filter_entries: 'Filtrele'
39 export: 'Dışa Aktar' 39 export: 'Dışa Aktar'
40 # notifications: 'Notifications'
40 search_form: 41 search_form:
41 input_label: 'Aramak istediğiniz herhangi bir şey yazın' 42 input_label: 'Aramak istediğiniz herhangi bir şey yazın'
42 43
@@ -242,6 +243,13 @@ entry:
242 public: 243 public:
243 # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>" 244 # shared_by_wallabag: "This article has been shared by <a href='%wallabag_instance%'>wallabag</a>"
244 245
246# notifications:
247# sidebar:
248# view_more: 'View more'
249# list:
250# page_title: 'Notifications'
251# mark_all_as_read: 'Mark all as read'
252
245about: 253about:
246 page_title: 'Hakkımızda' 254 page_title: 'Hakkımızda'
247 top_menu: 255 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Developer/client.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Developer/client.html.twig
index 8a5da71a..d566795d 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Developer/client.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Developer/client.html.twig
@@ -3,6 +3,7 @@
3{% block title %}{{ 'developer.client.page_title'|trans }}{% endblock %} 3{% block title %}{{ 'developer.client.page_title'|trans }}{% endblock %}
4 4
5{% block content %} 5{% block content %}
6{{ parent() }}
6<div class="row"> 7<div class="row">
7 <div class="col s12"> 8 <div class="col s12">
8 <div class="card-panel settings"> 9 <div class="card-panel settings">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Developer/index.html.twig
index b3f0affb..575770d6 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Developer/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Developer/index.html.twig
@@ -3,6 +3,7 @@
3{% block title %}{{ 'developer.page_title'|trans }}{% endblock %} 3{% block title %}{{ 'developer.page_title'|trans }}{% endblock %}
4 4
5{% block content %} 5{% block content %}
6{{ parent() }}
6<div class="row"> 7<div class="row">
7 <div class="col s12"> 8 <div class="col s12">
8 <div class="card-panel settings"> 9 <div class="card-panel settings">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/about.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/about.html.twig
index 1cd3485c..ffd9b1b8 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/about.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/about.html.twig
@@ -3,7 +3,7 @@
3{% block title %}{{ 'about.page_title'|trans }}{% endblock %} 3{% block title %}{{ 'about.page_title'|trans }}{% endblock %}
4 4
5{% block content %} 5{% block content %}
6 6 {{ parent() }}
7 <div class="row"> 7 <div class="row">
8 <div class="col s12"> 8 <div class="col s12">
9 <div class="card-panel settings"> 9 <div class="card-panel settings">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/howto.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/howto.html.twig
index 231f9bdf..4c598b85 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/howto.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/howto.html.twig
@@ -3,7 +3,7 @@
3{% block title %}{{ 'howto.page_title'|trans }}{% endblock %} 3{% block title %}{{ 'howto.page_title'|trans }}{% endblock %}
4 4
5{% block content %} 5{% block content %}
6 6 {{ parent() }}
7 <div class="row"> 7 <div class="row">
8 <div class="col s12"> 8 <div class="col s12">
9 <div class="card-panel settings"> 9 <div class="card-panel settings">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/quickstart.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/quickstart.html.twig
index 4580813c..70265be2 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/quickstart.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/quickstart.html.twig
@@ -3,7 +3,7 @@
3{% block title %}{{ 'quickstart.page_title'|trans }}{% endblock %} 3{% block title %}{{ 'quickstart.page_title'|trans }}{% endblock %}
4 4
5{% block content %} 5{% block content %}
6 6 {{ parent() }}
7 <div class="row quickstart"> 7 <div class="row quickstart">
8 <div class="col s12"> 8 <div class="col s12">
9 <div class="card-panel settings"> 9 <div class="card-panel settings">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
index 9b0816eb..67073c7d 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
@@ -3,7 +3,7 @@
3{% block title %}{{ 'config.page_title'|trans }}{% endblock %} 3{% block title %}{{ 'config.page_title'|trans }}{% endblock %}
4 4
5{% block content %} 5{% block content %}
6 6 {{ parent() }}
7 <div class="row"> 7 <div class="row">
8 <div class="col s12"> 8 <div class="col s12">
9 <div class="card-panel settings"> 9 <div class="card-panel settings">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
index b2d91c9c..b74d32b7 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
@@ -12,6 +12,7 @@
12{% endblock %} 12{% endblock %}
13 13
14{% block content %} 14{% block content %}
15 {{ parent() }}
15 {% set listMode = app.user.config.listMode %} 16 {% set listMode = app.user.config.listMode %}
16 <div class="results clearfix"> 17 <div class="results clearfix">
17 <div class="nb-results left"> 18 <div class="nb-results left">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Notification/notifications.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Notification/notifications.html.twig
new file mode 100644
index 00000000..bc72c704
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Notification/notifications.html.twig
@@ -0,0 +1,42 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'notifications.list.page_title' | trans }}{% endblock %}
4
5{% block content %}
6 <div class="row">
7 <div class="col l6 offset-l3">
8 <ul class="collection">
9 {% for notification in notifications | slice(0, 10) %}
10 <li class="collection-item avatar{% if not notification.read %} light-blue lighten-5{% else %} grey-text{% endif %}">
11 <i class="material-icons circle">{% spaceless %}
12 {% if notification.type == constant('TYPE_ADMIN', notification) %}
13 build
14 {% elseif notification.type == constant('TYPE_USER', notification) %}
15 person
16 {% elseif notification.type == constant('TYPE_RELEASE', notification) %}
17 new_releases
18 {% endif %}
19 {% endspaceless %}</i>
20 <span class="title">{{ notification.title }}</span>
21 <p><em>{{ notification.timestamp | date }}</p>
22 <div class="secondary-content">
23 {% for action in notification.actions %}
24 <a class="btn waves-effect waves-light {% spaceless %}
25 {% if action.type == constant('TYPE_OK', action) %}
26 {% elseif action.type == constant('TYPE_YES', action) %}
27 cyan
28 {% elseif action.type == constant('TYPE_NO', action) %}
29 red
30 {% elseif action.type == constant('TYPE_INFO', action) %}
31 blue-grey
32 {% endif %}
33 {% endspaceless %}" href="{{ action.link }}">{{ action.label }}</a>
34 {% endfor %}
35 </div>
36 </li>
37 {% endfor %}
38 </ul>
39 <a href="{{ path('notification-archive-all') }}" class="btn waves-effect waves-light ">{{ 'notifications.list.mark_all_as_read' | trans }}</a>
40 </div>
41 </div>
42{% 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 c83543ac..01dc4c6a 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
@@ -3,6 +3,7 @@
3{% block title %}{{ 'tag.page_title'|trans }}{% endblock %} 3{% block title %}{{ 'tag.page_title'|trans }}{% endblock %}
4 4
5{% block content %} 5{% block content %}
6 {{ parent() }}
6 <div class="results clearfix"> 7 <div class="results clearfix">
7 <div class="nb-results left">{{ 'tag.list.number_on_the_page'|transchoice(tags|length) }}</div> 8 <div class="nb-results left">{{ 'tag.list.number_on_the_page'|transchoice(tags|length) }}</div>
8 </div> 9 </div>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
index 2dab1c18..6e2828de 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
@@ -105,6 +105,13 @@
105 <i class="material-icons">search</i> 105 <i class="material-icons">search</i>
106 </a> 106 </a>
107 </li> 107 </li>
108 <li id="button_notifications">
109 {% set unreadNotifs = app.user.notifications | unread_notif | length %}
110 <a class="nav-panel-menu button-collapse-right tooltipped js-notifications-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.notifications' | trans }}" href="#" data-activates="notifications">
111 <i class="material-icons">notifications{% if unreadNotifs == 0 %}_none{% endif %}</i>
112 {% if unreadNotifs > 0 %}<span id="notifications-count" class="red-text text-accent-2">{{ unreadNotifs }}</span>{% endif %}
113 </a>
114 </li>
108 <li id="button_filters"> 115 <li id="button_filters">
109 <a class="nav-panel-menu button-collapse-right tooltipped js-filters-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.filter_entries'|trans }}" href="#" data-activates="filters"> 116 <a class="nav-panel-menu button-collapse-right tooltipped js-filters-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.filter_entries'|trans }}" href="#" data-activates="filters">
110 <i class="material-icons">filter_list</i> 117 <i class="material-icons">filter_list</i>
@@ -130,6 +137,44 @@
130 </nav> 137 </nav>
131{% endblock %} 138{% endblock %}
132 139
140{% block content %}
141
142 <div id="notifications" class="side-nav">
143 <ul class="collection">
144 {% for notification in app.user.notifications | slice(0, 10) %}
145 <li class="notification collection-item avatar{% if not notification.read %} light-blue lighten-5{% else %} grey-text{% endif %}">
146 <i class="material-icons circle">{% spaceless %}
147 {% if notification.type == constant('TYPE_ADMIN', notification) %}
148 build
149 {% elseif notification.type == constant('TYPE_USER', notification) %}
150 person
151 {% elseif notification.type == constant('TYPE_RELEASE', notification) %}
152 new_releases
153 {% endif %}
154 {% endspaceless %}</i>
155 <span class="title">{{ notification.title }}</span>
156 <p><em>{{ notification.timestamp | date }}</em></p>
157 <div>
158 {% for action in notification.actions %}
159 <a class="btn waves-effect waves-light {% spaceless %}
160 {% if action.type == constant('TYPE_OK', action) %}
161 {% elseif action.type == constant('TYPE_YES', action) %}
162 cyan
163 {% elseif action.type == constant('TYPE_NO', action) %}
164 red
165 {% elseif action.type == constant('TYPE_INFO', action) %}
166 blue-grey
167 {% endif %}
168 {% endspaceless %}" href="{{ action.link }}">{{ action.label }}</a>
169 {% endfor %}
170 </div>
171 </li>
172 {% endfor %}
173 </ul>
174 <a class="waves-effect waves-light btn" href="{{ path('notifications-all') }}">{{ 'notifications.sidebar.view_more' | trans }}</a>
175 </div>
176{% endblock %}
177
133{% block footer %} 178{% block footer %}
134 <footer class="page-footer cyan darken-2"> 179 <footer class="page-footer cyan darken-2">
135 <div class="footer-copyright"> 180 <div class="footer-copyright">
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
index a305c53f..ad224b6c 100644
--- a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
+++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
@@ -2,7 +2,9 @@
2 2
3namespace Wallabag\CoreBundle\Twig; 3namespace Wallabag\CoreBundle\Twig;
4 4
5use Doctrine\Common\Collections\Collection;
5use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; 6use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
7use Wallabag\CoreBundle\Notifications\NotificationInterface;
6use Wallabag\CoreBundle\Repository\EntryRepository; 8use Wallabag\CoreBundle\Repository\EntryRepository;
7use Wallabag\CoreBundle\Repository\TagRepository; 9use Wallabag\CoreBundle\Repository\TagRepository;
8use Symfony\Component\Translation\TranslatorInterface; 10use Symfony\Component\Translation\TranslatorInterface;
@@ -28,6 +30,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
28 { 30 {
29 return [ 31 return [
30 new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']), 32 new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']),
33 new \Twig_SimpleFilter('unread_notif', [$this, 'unreadNotif']),
31 ]; 34 ];
32 } 35 }
33 36
@@ -45,6 +48,13 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
45 return preg_replace('/^www\./i', '', $url); 48 return preg_replace('/^www\./i', '', $url);
46 } 49 }
47 50
51 public function unreadNotif(Collection $notifs)
52 {
53 return $notifs->filter(function(NotificationInterface $notif) {
54 return !$notif->isRead();
55 });
56 }
57
48 /** 58 /**
49 * Return number of entries depending of the type (unread, archive, starred or all). 59 * Return number of entries depending of the type (unread, archive, starred or all).
50 * 60 *
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php
index 3a167de7..2a8c9926 100644
--- a/src/Wallabag/UserBundle/Entity/User.php
+++ b/src/Wallabag/UserBundle/Entity/User.php
@@ -65,6 +65,11 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
65 protected $entries; 65 protected $entries;
66 66
67 /** 67 /**
68 * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\Notification", mappedBy="user", cascade={"remove"})
69 */
70 protected $notifications;
71
72 /**
68 * @ORM\OneToOne(targetEntity="Wallabag\CoreBundle\Entity\Config", mappedBy="user", cascade={"remove"}) 73 * @ORM\OneToOne(targetEntity="Wallabag\CoreBundle\Entity\Config", mappedBy="user", cascade={"remove"})
69 */ 74 */
70 protected $config; 75 protected $config;
@@ -266,4 +271,20 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
266 { 271 {
267 return $this->clients; 272 return $this->clients;
268 } 273 }
274
275 /**
276 * @return ArrayCollection<NotificationInterface>
277 */
278 public function getNotifications()
279 {
280 return $this->notifications;
281 }
282
283 /**
284 * @param ArrayCollection<NotificationInterface> $notifications
285 */
286 public function setNotifications($notifications)
287 {
288 $this->notifications = $notifications;
289 }
269} 290}
diff --git a/src/Wallabag/UserBundle/Resources/views/manage.html.twig b/src/Wallabag/UserBundle/Resources/views/manage.html.twig
index c614c55f..10d8050c 100644
--- a/src/Wallabag/UserBundle/Resources/views/manage.html.twig
+++ b/src/Wallabag/UserBundle/Resources/views/manage.html.twig
@@ -3,7 +3,7 @@
3{% block title %}{{ 'user.manage.page_title'|trans }}{% endblock %} 3{% block title %}{{ 'user.manage.page_title'|trans }}{% endblock %}
4 4
5{% block content %} 5{% block content %}
6 6 {{ parent() }}
7 <div class="row"> 7 <div class="row">
8 <div class="col s12"> 8 <div class="col s12">
9 <div class="card-panel"> 9 <div class="card-panel">