From 154dfa6c4c63d85bc797e8f1c1a0d499d34eb4f7 Mon Sep 17 00:00:00 2001 From: Leny BERNARD Date: Thu, 20 Oct 2016 00:53:05 +0200 Subject: [PATCH] :memo: rename troopers_alertifybundle.helper.alertifyhelper service to simpler alertify and update readme --- Controller/AlertifyControllerTrait.php | 10 +++++----- README.md | 20 +++++--------------- Resources/config/services.xml | 2 +- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/Controller/AlertifyControllerTrait.php b/Controller/AlertifyControllerTrait.php index b7de8c5..ae67050 100644 --- a/Controller/AlertifyControllerTrait.php +++ b/Controller/AlertifyControllerTrait.php @@ -18,7 +18,7 @@ trait AlertifyControllerTrait */ public function alert($content, $type = 'success', $options = []) { - $this->container->get('troopers_alertifybundle.helper.alertifyhelper')->alert($content, $type, $options); + $this->container->get('alertify')->alert($content, $type, $options); } /** @@ -29,7 +29,7 @@ public function alert($content, $type = 'success', $options = []) */ public function congrat($content, $options = []) { - $this->container->get('troopers_alertifybundle.helper.alertifyhelper')->congrat($content, $options); + $this->container->get('alertify')->congrat($content, $options); } /** @@ -40,7 +40,7 @@ public function congrat($content, $options = []) */ public function warn($content, $options = []) { - $this->container->get('troopers_alertifybundle.helper.alertifyhelper')->warn($content, $options); + $this->container->get('alertify')->warn($content, $options); } /** @@ -51,7 +51,7 @@ public function warn($content, $options = []) */ public function inform($content, $options = []) { - $this->container->get('troopers_alertifybundle.helper.alertifyhelper')->inform($content, $options); + $this->container->get('alertify')->inform($content, $options); } /** @@ -62,6 +62,6 @@ public function inform($content, $options = []) */ public function scold($content, $options = []) { - $this->container->get('troopers_alertifybundle.helper.alertifyhelper')->scold($content, $options); + $this->container->get('alertify')->scold($content, $options); } } diff --git a/README.md b/README.md index 16f3dd0..40d09d1 100644 --- a/README.md +++ b/README.md @@ -105,25 +105,15 @@ troopers_alertify: How to ? ------------ -It's easy to use, just follow the following: - -Add this block at the end of your twig layout: - - {% block alertify %} - {{ app.session|alertify|raw }} - {% endblock %} - -Now, anywhere, you can put your alert in the flash session and enjoy. - $this->get('session')->getFlashBag()->add('success', 'ok'); $this->get('session')->getFlashBag()->add('warning', array('body' => 'ok', 'context' => 'front', 'options' => ['option1' => 'custom value']); -You can use the `troopers_alertifybundle.helper.alertifyhelper` service to ease the alert creation : +You can use the `alertify` service to ease the alert creation : - $this->container->get('troopers_alertifybundle.helper.alertifyhelper')->congrat('TEST', $options); - $this->container->get('troopers_alertifybundle.helper.alertifyhelper')->warn('TEST', $options); - $this->container->get('troopers_alertifybundle.helper.alertifyhelper')->inform('TEST', $options); - $this->container->get('troopers_alertifybundle.helper.alertifyhelper')->scold('TEST', $options); + $this->container->get('alertify')->congrat('TEST', $options); + $this->container->get('alertify')->warn('TEST', $options); + $this->container->get('alertify')->inform('TEST', $options); + $this->container->get('alertify')->scold('TEST', $options); You can also use the AlertifyControllerTrait to have simple methods in controller : diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 83515d3..2d6f339 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -11,7 +11,7 @@ - +