Sha256: d5ddd50abefc403501a4dc93383199d37172ff275486ab20592e7bfb9b8643f9

Contents?: true

Size: 1.06 KB

Versions: 27

Compression:

Stored size: 1.06 KB

Contents

/**
 * @namespace WORKAREA.impersonationNotification
 */
WORKAREA.registerModule('impersonationNotification', (function () {
    'use strict';

    var pathExcluded = function () {
            var paths = WORKAREA.config.impersonationNotification.excludedPaths;

            return _.reduce(paths, function (result, path) {
                return _.includes(window.location.pathname, path);
            }, false);
        },

        confirm = function ($form) {
            var confirmed = window.confirm(
                $form.data('impersonationNotification')
            );

            if (confirmed) { return; }

            $form.trigger('submit');
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.impersonationNotification
         */
        init = _.once(function ($scope) {
            var $form = $('[data-impersonation-notification]', $scope);

            if (_.isEmpty($form)) { return; }
            if (pathExcluded()) { return; }

            confirm($form);
        });

    return {
        init: init
    };
}()));

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.26 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.25 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.23 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.22 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.21 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.20 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.19 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.18 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.17 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.16 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.15 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.14 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.13 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.12 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.11 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.10 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.9 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.8 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js
workarea-admin-3.5.7 app/assets/javascripts/workarea/admin/modules/impersonation_notification.js