aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2017-05-12 15:02:32 +0200
committerThomas Citharel <tcit@tcit.fr>2017-06-23 10:02:45 +0200
commitf256145f404f6afa0b2888829c1285fe17445dd4 (patch)
tree7a276fc708b161e500474715c2851f412d4abc9a
parente0f9010ec2a558f6cf7d16fb96a2c4cdb34e3f37 (diff)
downloadwallabag-f256145f404f6afa0b2888829c1285fe17445dd4.tar.gz
wallabag-f256145f404f6afa0b2888829c1285fe17445dd4.tar.zst
wallabag-f256145f404f6afa0b2888829c1285fe17445dd4.zip
First draft for notifications
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
-rwxr-xr-xapp/Resources/static/themes/material/index.js9
-rw-r--r--src/Wallabag/CoreBundle/Controller/NotificationsController.php1
-rw-r--r--src/Wallabag/CoreBundle/Entity/Notification.php13
-rw-r--r--src/Wallabag/CoreBundle/Notifications/Action.php1
-rw-r--r--src/Wallabag/CoreBundle/Notifications/ActionInterface.php1
-rw-r--r--src/Wallabag/CoreBundle/Notifications/NotificationInterface.php4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml7
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml7
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml7
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml7
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml7
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml7
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml7
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml7
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml7
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml7
-rw-r--r--src/Wallabag/CoreBundle/Twig/WallabagExtension.php1
19 files changed, 92 insertions, 10 deletions
diff --git a/app/Resources/static/themes/material/index.js b/app/Resources/static/themes/material/index.js
index 435cd02f..e16749f6 100755
--- a/app/Resources/static/themes/material/index.js
+++ b/app/Resources/static/themes/material/index.js
@@ -76,4 +76,13 @@ $(document).ready(() => {
76 const scrollPercent = (s / (d - c)) * 100; 76 const scrollPercent = (s / (d - c)) * 100;
77 $('.progress .determinate').css('width', `${scrollPercent}%`); 77 $('.progress .determinate').css('width', `${scrollPercent}%`);
78 }); 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 });
79}); 88});
diff --git a/src/Wallabag/CoreBundle/Controller/NotificationsController.php b/src/Wallabag/CoreBundle/Controller/NotificationsController.php
index 17e576cd..ec7bf3c0 100644
--- a/src/Wallabag/CoreBundle/Controller/NotificationsController.php
+++ b/src/Wallabag/CoreBundle/Controller/NotificationsController.php
@@ -40,6 +40,7 @@ class NotificationsController extends Controller
40 'notifications' => $notifications, 40 'notifications' => $notifications,
41 'currentPage' => $page, 41 'currentPage' => $page,
42 ]); 42 ]);
43
43 } 44 }
44 45
45 /** 46 /**
diff --git a/src/Wallabag/CoreBundle/Entity/Notification.php b/src/Wallabag/CoreBundle/Entity/Notification.php
index 6b30b044..aa4c03c3 100644
--- a/src/Wallabag/CoreBundle/Entity/Notification.php
+++ b/src/Wallabag/CoreBundle/Entity/Notification.php
@@ -12,6 +12,7 @@ use Wallabag\UserBundle\Entity\User;
12 12
13/** 13/**
14 * Class Notification. 14 * Class Notification.
15 * Class Notification
15 * 16 *
16 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\NotificationRepository") 17 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\NotificationRepository")
17 * @ORM\Table(name="`notification`") 18 * @ORM\Table(name="`notification`")
@@ -24,32 +25,32 @@ class Notification implements NotificationInterface
24 * @ORM\Column(name="id", type="integer") 25 * @ORM\Column(name="id", type="integer")
25 * @ORM\Id 26 * @ORM\Id
26 * @ORM\GeneratedValue(strategy="AUTO") 27 * @ORM\GeneratedValue(strategy="AUTO")
28 *
27 */ 29 */
28 protected $id; 30 protected $id;
29 31
30 /** 32 /**
31 * @var int 33 * @var int $type
32 * 34 *
33 * @ORM\Column(name="type", type="integer") 35 * @ORM\Column(name="type", type="integer")
34 */ 36 */
35 protected $type; 37 protected $type;
36 38
37 /** 39 /**
38 * @var User 40 * @var User $user
39 * 41 *
40 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="notifications") 42 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="notifications")
41 */ 43 */
42 protected $user; 44 protected $user;
43 45
44 /** 46 /**
45 * @var \DateTime
46 * 47 *
47 * @ORM\Column(name="timestamp", type="datetime") 48 * @ORM\Column(name="timestamp", type="datetime")
48 */ 49 */
49 protected $timestamp; 50 protected $timestamp;
50 51
51 /** 52 /**
52 * @var string 53 * @var string $title
53 * 54 *
54 * @ORM\Column(name="title", type="string") 55 * @ORM\Column(name="title", type="string")
55 */ 56 */
@@ -63,7 +64,7 @@ class Notification implements NotificationInterface
63 protected $description; 64 protected $description;
64 65
65 /** 66 /**
66 * @var bool 67 * @var boolean $read
67 * 68 *
68 * @ORM\Column(name="read", type="boolean") 69 * @ORM\Column(name="read", type="boolean")
69 */ 70 */
@@ -225,7 +226,6 @@ class Notification implements NotificationInterface
225 * @param ActionInterface $action 226 * @param ActionInterface $action
226 * 227 *
227 * @return NotificationInterface 228 * @return NotificationInterface
228 *
229 * @throws \InvalidArgumentException 229 * @throws \InvalidArgumentException
230 */ 230 */
231 public function addAction(ActionInterface $action) 231 public function addAction(ActionInterface $action)
@@ -235,7 +235,6 @@ class Notification implements NotificationInterface
235 } 235 }
236 $this->actionTypes[$action->getType()] = true; 236 $this->actionTypes[$action->getType()] = true;
237 $this->actions->add($action); 237 $this->actions->add($action);
238
239 return $this; 238 return $this;
240 } 239 }
241 240
diff --git a/src/Wallabag/CoreBundle/Notifications/Action.php b/src/Wallabag/CoreBundle/Notifications/Action.php
index d032adf9..d92ffe54 100644
--- a/src/Wallabag/CoreBundle/Notifications/Action.php
+++ b/src/Wallabag/CoreBundle/Notifications/Action.php
@@ -56,7 +56,6 @@ class Action implements ActionInterface
56 * @param int $type 56 * @param int $type
57 * 57 *
58 * @return ActionInterface 58 * @return ActionInterface
59 *
60 * @throws \InvalidArgumentException 59 * @throws \InvalidArgumentException
61 */ 60 */
62 public function setType($type) 61 public function setType($type)
diff --git a/src/Wallabag/CoreBundle/Notifications/ActionInterface.php b/src/Wallabag/CoreBundle/Notifications/ActionInterface.php
index e166e45b..d6bb0fcc 100644
--- a/src/Wallabag/CoreBundle/Notifications/ActionInterface.php
+++ b/src/Wallabag/CoreBundle/Notifications/ActionInterface.php
@@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Notifications;
4 4
5interface ActionInterface 5interface ActionInterface
6{ 6{
7
7 /** 8 /**
8 * @return string 9 * @return string
9 */ 10 */
diff --git a/src/Wallabag/CoreBundle/Notifications/NotificationInterface.php b/src/Wallabag/CoreBundle/Notifications/NotificationInterface.php
index 4a3c2759..fa226487 100644
--- a/src/Wallabag/CoreBundle/Notifications/NotificationInterface.php
+++ b/src/Wallabag/CoreBundle/Notifications/NotificationInterface.php
@@ -37,12 +37,12 @@ interface NotificationInterface extends LoggerAwareInterface
37 /** 37 /**
38 * If the notification has been viewed / dismissed or not. 38 * If the notification has been viewed / dismissed or not.
39 * 39 *
40 * @return bool 40 * @return boolean
41 */ 41 */
42 public function isRead(); 42 public function isRead();
43 43
44 /** 44 /**
45 * @param bool $read 45 * @param boolean $read
46 * 46 *
47 * @return NotificationInterface 47 * @return NotificationInterface
48 */ 48 */
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index ad03fa91..906b8396 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -262,6 +262,13 @@ entry:
262# title: "wallabag has been updated to version %version%" 262# title: "wallabag has been updated to version %version%"
263# details: "View update's details" 263# details: "View update's details"
264 264
265# notifications:
266# sidebar:
267# view_more: 'View more'
268# list:
269# page_title: 'Notifications'
270# mark_all_as_read: 'Mark all as read'
271
265about: 272about:
266 page_title: 'Om' 273 page_title: 'Om'
267 top_menu: 274 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index f2d75a62..c0e583c4 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -262,6 +262,13 @@ entry:
262# title: "wallabag has been updated to version %version%" 262# title: "wallabag has been updated to version %version%"
263# details: "View update's details" 263# details: "View update's details"
264 264
265# notifications:
266# sidebar:
267# view_more: 'View more'
268# list:
269# page_title: 'Notifications'
270# mark_all_as_read: 'Mark all as read'
271
265about: 272about:
266 page_title: 'Über' 273 page_title: 'Über'
267 top_menu: 274 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 228dd87e..98f1b48c 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -261,6 +261,7 @@ notifications:
261 release: 261 release:
262 title: "wallabag has been updated to version %version%" 262 title: "wallabag has been updated to version %version%"
263 details: "View update's details" 263 details: "View update's details"
264
264about: 265about:
265 page_title: 'About' 266 page_title: 'About'
266 top_menu: 267 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 28f064c7..2c3a005c 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -262,6 +262,13 @@ entry:
262# title: "wallabag has been updated to version %version%" 262# title: "wallabag has been updated to version %version%"
263# details: "View update's details" 263# details: "View update's details"
264 264
265# notifications:
266# sidebar:
267# view_more: 'View more'
268# list:
269# page_title: 'Notifications'
270# mark_all_as_read: 'Mark all as read'
271
265about: 272about:
266 page_title: 'Acerca de' 273 page_title: 'Acerca de'
267 top_menu: 274 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index 4496a2f2..8f0392e0 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -262,6 +262,13 @@ entry:
262# title: "wallabag has been updated to version %version%" 262# title: "wallabag has been updated to version %version%"
263# details: "View update's details" 263# details: "View update's details"
264 264
265# notifications:
266# sidebar:
267# view_more: 'View more'
268# list:
269# page_title: 'Notifications'
270# mark_all_as_read: 'Mark all as read'
271
265about: 272about:
266 page_title: 'درباره' 273 page_title: 'درباره'
267 top_menu: 274 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 8bccc8a4..277f2f63 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -262,6 +262,13 @@ notifications:
262 title: "wallabag a été mis à jour vers la version %version%" 262 title: "wallabag a été mis à jour vers la version %version%"
263 details: "Voir les détails de la mise à jour" 263 details: "Voir les détails de la mise à jour"
264 264
265notifications:
266 sidebar:
267 view_more: 'Voir plus'
268 list:
269 page_title: 'Notifications'
270 mark_all_as_read: 'Marquer tout comme lu'
271
265about: 272about:
266 page_title: "À propos" 273 page_title: "À propos"
267 top_menu: 274 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index c404b3e5..3edd4973 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -261,6 +261,7 @@ entry:
261# release: 261# release:
262# title: "wallabag has been updated to version %version%" 262# title: "wallabag has been updated to version %version%"
263# details: "View update's details" 263# details: "View update's details"
264
264about: 265about:
265 page_title: 'A proposito' 266 page_title: 'A proposito'
266 top_menu: 267 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index af9d85c3..cd690e9f 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -262,6 +262,13 @@ entry:
262# title: "wallabag has been updated to version %version%" 262# title: "wallabag has been updated to version %version%"
263# details: "View update's details" 263# details: "View update's details"
264 264
265# notifications:
266# sidebar:
267# view_more: 'View more'
268# list:
269# page_title: 'Notifications'
270# mark_all_as_read: 'Mark all as read'
271
265about: 272about:
266 page_title: 'A prepaus' 273 page_title: 'A prepaus'
267 top_menu: 274 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index 78464162..de357bfe 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -262,6 +262,13 @@ entry:
262# title: "wallabag has been updated to version %version%" 262# title: "wallabag has been updated to version %version%"
263# details: "View update's details" 263# details: "View update's details"
264 264
265# notifications:
266# sidebar:
267# view_more: 'View more'
268# list:
269# page_title: 'Notifications'
270# mark_all_as_read: 'Mark all as read'
271
265about: 272about:
266 page_title: 'O nas' 273 page_title: 'O nas'
267 top_menu: 274 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
index 07eeefc2..2d71cb9d 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
@@ -262,6 +262,13 @@ entry:
262# title: "wallabag has been updated to version %version%" 262# title: "wallabag has been updated to version %version%"
263# details: "View update's details" 263# details: "View update's details"
264 264
265# notifications:
266# sidebar:
267# view_more: 'View more'
268# list:
269# page_title: 'Notifications'
270# mark_all_as_read: 'Mark all as read'
271
265about: 272about:
266 page_title: 'Sobre' 273 page_title: 'Sobre'
267 top_menu: 274 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index ba7b11d5..f295378d 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -262,6 +262,13 @@ entry:
262# title: "wallabag has been updated to version %version%" 262# title: "wallabag has been updated to version %version%"
263# details: "View update's details" 263# details: "View update's details"
264 264
265# notifications:
266# sidebar:
267# view_more: 'View more'
268# list:
269# page_title: 'Notifications'
270# mark_all_as_read: 'Mark all as read'
271
265about: 272about:
266 page_title: 'Despre' 273 page_title: 'Despre'
267 top_menu: 274 top_menu:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 6cbe6dcd..8b791b48 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -260,6 +260,13 @@ entry:
260# title: "wallabag has been updated to version %version%" 260# title: "wallabag has been updated to version %version%"
261# details: "View update's details" 261# details: "View update's details"
262 262
263# notifications:
264# sidebar:
265# view_more: 'View more'
266# list:
267# page_title: 'Notifications'
268# mark_all_as_read: 'Mark all as read'
269
263about: 270about:
264 page_title: 'Hakkımızda' 271 page_title: 'Hakkımızda'
265 top_menu: 272 top_menu:
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
index 034b3fa2..71dd7c2a 100644
--- a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
+++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
@@ -2,6 +2,7 @@
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;
6use Wallabag\CoreBundle\Notifications\NotificationInterface; 7use Wallabag\CoreBundle\Notifications\NotificationInterface;
7use Wallabag\CoreBundle\Repository\EntryRepository; 8use Wallabag\CoreBundle\Repository\EntryRepository;