1.0.2 • Published 7 years ago

wasabilib-gritter v1.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Introduction

wasabilib-gritter is an addon for wasabilib-for-node. You can answer wasabilib ajax request with growl-like notifications. Please see https://www.npmjs.com/package/wasabilib-for-node and follow the installation instructions first.

Install

    $ npm install --save wasabilib-gritter

After installation go into the folder wasabilib-gritter and copy the minimized files in client-side/wasabilib/css to the wasabilib/css folder in your project. The same goes for the minimized js file under client-side/wasabilib/js. Include both the css and the js file in your html layout template after jquery and the wasabilib.min.js.

Font-Awesome icon library is necessary for defining message types.

Usage

    var Wasabilib = require('wasabilib-for-node');
    var Gritter = require('wasabilib-gritter'));
    let response = new Wasabilib.Response(new Gritter('my message','my Title'));
    res.send(response);

Features

Setting a message type

    new Gritter('my message','my Title',Gritter.typeAlert);

This produces a red colored notification with a font-awesome alert icon. Available types are: Gritter.typeAlert Gritter.typeInfo Gritter.typeError Gritter.typeSuccess

Every type defines a corresponding color and an icon.

Setting an Icon

     var Gritter = require('wasabilib-gritter/GritterMessage'));
     var gritter = new Gritter('my Message', 'my Title');
     gritter.icon = 'fa fa-home';

Setting an Image

     var Gritter = require('wasabilib-gritter/GritterMessage'));
     var gritter = new Gritter('my Message', 'my Title');
     gritter.image = 'url/to/image';

Changing Display Time

You can change the time how long the notification is on screen. gritter.time = timeInMilliSeconds. When sticky is set to true the time parameter will be ignored.

Make Notifications Sticky

gritter.sticky = true

Note: The time parameter will be ignored when sticky is set to true.

License

MIT ©