Skip to content

Commit

Permalink
📝 rename troopers_alertifybundle.helper.alertifyhelper service to sim…
Browse files Browse the repository at this point in the history
…pler alertify and update readme
  • Loading branch information
Leny BERNARD committed Oct 19, 2016
1 parent 7fe9eef commit 154dfa6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
10 changes: 5 additions & 5 deletions Controller/AlertifyControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}
}
20 changes: 5 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 :

Expand Down
2 changes: 1 addition & 1 deletion Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parameters>

<services>
<service id="troopers_alertifybundle.helper.alertifyhelper" class="%alertify.helper.class%">
<service id="alertify" class="%alertify.helper.class%">
<argument type="service" id="session" />
</service>
<service id="troopers_alertifybundle.session_handler" class="%alertify.handler.session.class%">
Expand Down

0 comments on commit 154dfa6

Please sign in to comment.