2017 © Pedro PelĂĄez
 

library szm-noty

jQuery plugin to notifications for Zend Framework 2/3

image

szmnmichalowski/szm-noty

jQuery plugin to notifications for Zend Framework 2/3

  • Saturday, March 25, 2017
  • by szmnmichalowski
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

SzmNoty

Software License Build Status Code Coverage, (*1)

SzmNoty is a Zend Framework 2/3 view helper integerated with jQyert Noty) plugin to render notifications from SzmNotification controller plugin., (*2)

Notifications, (*3)

Installation

You can install this module via composer, (*4)

1. Add this project into your composer.json, (*5)

"require": {
    "szmnmichalowski/szm-noty": "dev-master"
}

2. Update your dependencies, (*6)

$ php composer.phar update

3. Add module to your application.config.php., (*7)

return array(
    'modules' => array(
        'Zend\Session',
        'SzmNotification' // <- Add this line
        'SzmNoty' // <- Add this line
    )
);

Configuration

Copy szm-noty/config/noty.local.php.dist file to root config/autoload and rename to noty.local.php (remove .dist extension) Configuration file should looks like this:, (*8)

return [
    'notifications' => [
        'library_url' => 'https://cdnjs.cloudflare.com/ajax/libs/jquery-noty/2.4.1/packaged/jquery.noty.packaged.min.js',
        'default_options' => [
            'timeout' => 3000,
            'callback' => [
                'afterShow' => 'function() {
                    console.log("Test!")
                }'
            ]
        ],
        'types' => [
            'info' => [
                'type' => 'info',
            ],
            'success' => [
                'type' => 'success',
                'timeout' => 6000,
            ],
            'warning' => [
                'type' => 'warning'
            ],
            'error' => [
                'type' => 'error'
            ],
        ],
    ]
];

default_options - Options for all types of notifications. types - Options for specific type of notifications (success may have different options then error), (*9)

Full list of options you can find on http://ned.im/noty/options.html, (*10)

Usage

If you need detailed informations how to add notification in controller visit SzmNotification module., (*11)

In controller:, (*12)

    public function indexAction()
    {
        $this->notification()->add('info', 'This is info');
        $this->notification()->add('success', 'This is success');
        $this->notification()->add('warning', 'This is warning');
        $this->notification()->add('error', 'This is error');
        ...
    }

Then in your layout or view:, (*13)

<?= $this->notification()->setIncludeLibrary(true)->renderCurrent(); ?>

In result, you should see notifications as on image above, (*14)

Available methods

List of available methods: - setIncludeLibrary() - If true then link to noty's library will be attached. Use it if you didn't add path to library manually. Default false - render(string $type = null, $options = []) - Render notifications from previous request. If no parameters are provided then it displays all notifications with options provided in config file - renderCurrent(string $type = null, $options = []) - Same as above with one difference. It render notifications added during this request., (*15)

The Versions

25/03 2017

dev-master

9999999-dev https://github.com/szmnmichalowski/SzmNoty

jQuery plugin to notifications for Zend Framework 2/3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Szymon MichaƂowski

extension zend notification noty

25/03 2017

1.0.0

1.0.0.0 https://github.com/szmnmichalowski/SzmNoty

jQuery plugin to notifications for Zend Framework 2/3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Szymon MichaƂowski

extension zend notification noty