Sha256: d2d534a322fb54d4ba2f96b2c97abb14d8b8fda4243fba1ac1a838df759dcf42

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

(function(object) {
  'use strict';

  object.flash = {
    success: function(message) {
      object.flash.flashMessage('success', message);
    },

    error: function(message) {
      object.flash.danger(message);
    },
    danger: function(message) {
      object.flash.flashMessage('danger', message);
    },

    alert: function(message) {
      object.flash.warning(message);
    },
    warning: function(message) {
      object.flash.flashMessage('warning', message);
    },

    notice: function(message) {
      object.flash.info(message);
    },
    info: function(message) {
      object.flash.flashMessage('info', message);
    },

    flashMessage: function(type, message) {
      if (message === '' || message === undefined) {
        return false;
      }

      type = type || 'warning';

      $('.alert-messages').append(
        '<div class="alert alert-' + type + ' alert-link alert-dismissable" role="alert">' +
          message +
          '<button type="button" class="close" data-dismiss="alert" aria-label="Close">' +
            '<span aria-hidden="true">&times;</span>' +
          '</button>' +
        '</div>');

      setTimeout(function(){
        $('.alert').alert('close');
      }, 5000);
    }
  };

  return object;
}(Archangel || {}));

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archangel-0.4.0 app/assets/javascripts/archangel/object/flash.js