From f256145f404f6afa0b2888829c1285fe17445dd4 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 12 May 2017 15:02:32 +0200 Subject: First draft for notifications Signed-off-by: Thomas Citharel --- app/Resources/static/themes/material/index.js | 9 +++++++++ .../CoreBundle/Controller/NotificationsController.php | 1 + src/Wallabag/CoreBundle/Entity/Notification.php | 13 ++++++------- src/Wallabag/CoreBundle/Notifications/Action.php | 1 - src/Wallabag/CoreBundle/Notifications/ActionInterface.php | 1 + .../CoreBundle/Notifications/NotificationInterface.php | 4 ++-- .../CoreBundle/Resources/translations/messages.da.yml | 7 +++++++ .../CoreBundle/Resources/translations/messages.de.yml | 7 +++++++ .../CoreBundle/Resources/translations/messages.en.yml | 1 + .../CoreBundle/Resources/translations/messages.es.yml | 7 +++++++ .../CoreBundle/Resources/translations/messages.fa.yml | 7 +++++++ .../CoreBundle/Resources/translations/messages.fr.yml | 7 +++++++ .../CoreBundle/Resources/translations/messages.it.yml | 1 + .../CoreBundle/Resources/translations/messages.oc.yml | 7 +++++++ .../CoreBundle/Resources/translations/messages.pl.yml | 7 +++++++ .../CoreBundle/Resources/translations/messages.pt.yml | 7 +++++++ .../CoreBundle/Resources/translations/messages.ro.yml | 7 +++++++ .../CoreBundle/Resources/translations/messages.tr.yml | 7 +++++++ src/Wallabag/CoreBundle/Twig/WallabagExtension.php | 1 + 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(() => { const scrollPercent = (s / (d - c)) * 100; $('.progress .determinate').css('width', `${scrollPercent}%`); }); + + $('.notification').on('click', () => { + $.ajax({ + url: Routing.generate('notification-archive-all'), + method: 'GET', + }).done(() => { + $('#notifications').sideNav('hide'); + }); + }); }); 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 'notifications' => $notifications, 'currentPage' => $page, ]); + } /** 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; /** * Class Notification. + * Class Notification * * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\NotificationRepository") * @ORM\Table(name="`notification`") @@ -24,32 +25,32 @@ class Notification implements NotificationInterface * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") + * */ protected $id; /** - * @var int + * @var int $type * * @ORM\Column(name="type", type="integer") */ protected $type; /** - * @var User + * @var User $user * * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="notifications") */ protected $user; /** - * @var \DateTime * * @ORM\Column(name="timestamp", type="datetime") */ protected $timestamp; /** - * @var string + * @var string $title * * @ORM\Column(name="title", type="string") */ @@ -63,7 +64,7 @@ class Notification implements NotificationInterface protected $description; /** - * @var bool + * @var boolean $read * * @ORM\Column(name="read", type="boolean") */ @@ -225,7 +226,6 @@ class Notification implements NotificationInterface * @param ActionInterface $action * * @return NotificationInterface - * * @throws \InvalidArgumentException */ public function addAction(ActionInterface $action) @@ -235,7 +235,6 @@ class Notification implements NotificationInterface } $this->actionTypes[$action->getType()] = true; $this->actions->add($action); - return $this; } 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 * @param int $type * * @return ActionInterface - * * @throws \InvalidArgumentException */ 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; interface ActionInterface { + /** * @return string */ 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 /** * If the notification has been viewed / dismissed or not. * - * @return bool + * @return boolean */ public function isRead(); /** - * @param bool $read + * @param boolean $read * * @return NotificationInterface */ 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: # title: "wallabag has been updated to version %version%" # details: "View update's details" +# notifications: +# sidebar: +# view_more: 'View more' +# list: +# page_title: 'Notifications' +# mark_all_as_read: 'Mark all as read' + about: page_title: 'Om' 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: # title: "wallabag has been updated to version %version%" # details: "View update's details" +# notifications: +# sidebar: +# view_more: 'View more' +# list: +# page_title: 'Notifications' +# mark_all_as_read: 'Mark all as read' + about: page_title: 'Über' 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: release: title: "wallabag has been updated to version %version%" details: "View update's details" + about: page_title: 'About' 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: # title: "wallabag has been updated to version %version%" # details: "View update's details" +# notifications: +# sidebar: +# view_more: 'View more' +# list: +# page_title: 'Notifications' +# mark_all_as_read: 'Mark all as read' + about: page_title: 'Acerca de' 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: # title: "wallabag has been updated to version %version%" # details: "View update's details" +# notifications: +# sidebar: +# view_more: 'View more' +# list: +# page_title: 'Notifications' +# mark_all_as_read: 'Mark all as read' + about: page_title: 'درباره' 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: title: "wallabag a été mis à jour vers la version %version%" details: "Voir les détails de la mise à jour" +notifications: + sidebar: + view_more: 'Voir plus' + list: + page_title: 'Notifications' + mark_all_as_read: 'Marquer tout comme lu' + about: page_title: "À propos" 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: # release: # title: "wallabag has been updated to version %version%" # details: "View update's details" + about: page_title: 'A proposito' 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: # title: "wallabag has been updated to version %version%" # details: "View update's details" +# notifications: +# sidebar: +# view_more: 'View more' +# list: +# page_title: 'Notifications' +# mark_all_as_read: 'Mark all as read' + about: page_title: 'A prepaus' 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: # title: "wallabag has been updated to version %version%" # details: "View update's details" +# notifications: +# sidebar: +# view_more: 'View more' +# list: +# page_title: 'Notifications' +# mark_all_as_read: 'Mark all as read' + about: page_title: 'O nas' 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: # title: "wallabag has been updated to version %version%" # details: "View update's details" +# notifications: +# sidebar: +# view_more: 'View more' +# list: +# page_title: 'Notifications' +# mark_all_as_read: 'Mark all as read' + about: page_title: 'Sobre' 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: # title: "wallabag has been updated to version %version%" # details: "View update's details" +# notifications: +# sidebar: +# view_more: 'View more' +# list: +# page_title: 'Notifications' +# mark_all_as_read: 'Mark all as read' + about: page_title: 'Despre' 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: # title: "wallabag has been updated to version %version%" # details: "View update's details" +# notifications: +# sidebar: +# view_more: 'View more' +# list: +# page_title: 'Notifications' +# mark_all_as_read: 'Mark all as read' + about: page_title: 'Hakkımızda' 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 @@ namespace Wallabag\CoreBundle\Twig; +use Doctrine\Common\Collections\Collection; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Wallabag\CoreBundle\Notifications\NotificationInterface; use Wallabag\CoreBundle\Repository\EntryRepository; -- cgit v1.2.3