Sha256: f00d25241f0d78b7ac35480b8459af9ef4158846d5ed932ff26fbbfac0ee16de

Contents?: true

Size: 1004 Bytes

Versions: 17

Compression:

Stored size: 1004 Bytes

Contents

/**
 * @ngdoc service
 * @name  Bastion.components.service:Notification
 *
 * @description
 *  Service to display a foreman toast notification
 */
angular.module('Bastion.components').service("Notification", ['$interpolate', 'foreman', function ($interpolate, foreman) {
    function interpolateIfNeeded(message, context) {
        var result = message;

        if (context) {
            result = $interpolate(message)(context);
        }

        return result;
    }

    this.setSuccessMessage = function (message, context) {
        foreman.toastNotifications.notify({message: interpolateIfNeeded(message, context), type: 'success'});
    };

    this.setWarningMessage = function (message, context) {
        foreman.toastNotifications.notify({message: interpolateIfNeeded(message, context), type: 'warning'});
    };

    this.setErrorMessage = function (message, context) {
        foreman.toastNotifications.notify({message: interpolateIfNeeded(message, context), type: 'danger'});
    };
}]);

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bastion-6.1.15 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.14 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.13 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.12 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.11 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.10 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.9 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.8 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.7 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.6 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.5 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.4 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.3 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.2 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.1 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.1.0 app/assets/javascripts/bastion/components/notification.service.js
bastion-6.0.0 app/assets/javascripts/bastion/components/notification.service.js