Sha256: 73c16bf952e3d53fbac66e79ca079cd2c6e3dde47e319239bf89afbae5555b61

Contents?: true

Size: 1.27 KB

Versions: 9

Compression:

Stored size: 1.27 KB

Contents

/**
 * Class creating simple notifications. Borrowed from http://dev.sencha.com/extjs/5.1.0/examples/shared/examples.js
 * @class Netzke.Notifier
 */
Ext.define('Netzke.Notifier', function(){
  var msgCt;

  function createBox(t, s){
    return t ?
      '<div class="msg ' + Ext.baseCSSPrefix + 'border-box"><h3>' + t + '</h3><p>' + s + '</p></div>'
    :
      '<div class="msg ' + Ext.baseCSSPrefix + 'border-box"><p>' + s + '</p></div>';
  }


  return {
    /**
     * Shows notification on the screen.
     * @method msg
     * @param {String} msg Notification body HTML
     * @param {Object} options May contain the following keys:
     *
     *   * **title** - title of notification
     *   * **delay** (ms) - time notification should stay on the screen
     */
    msg: function(msg, options){
      if (options == undefined) options = {};

      if (Ext.isArray(msg)) {
        msg = msg.join("<br>")
      }

      if (msgCt) {
        document.body.appendChild(msgCt.dom);
      } else {
        msgCt = Ext.DomHelper.append(document.body, {id:'msg-div'}, true);
      }
      var m = Ext.DomHelper.append(msgCt, createBox(options.title, msg), true);
      m.hide();
      m.slideIn('t').ghost("t", { delay: options.delay || Netzke.Core.NotificationDelay, remove: true});
    }
  };
});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
netzke-core-6.5.0.0 javascripts/notifications.js
netzke-core-6.5.0.0.rc2 javascripts/notifications.js
netzke-core-6.5.0.0.rc1 javascripts/notifications.js
netzke-core-1.0.1.0 javascripts/notifications.js
netzke-core-1.0.0.0 javascripts/notifications.js
netzke-core-1.0.0.0.pre4 javascripts/notifications.js
netzke-core-1.0.0.0.pre3 javascripts/notifications.js
netzke-core-1.0.0.0.pre2 javascripts/notifications.js
netzke-core-1.0.0.0.pre javascripts/notifications.js