Sha256: 421a8ec547b44f9d4af59fcc8c2075baf46c26f8ed4b07860abc77bcd6ad5e21

Contents?: true

Size: 1.34 KB

Versions: 62

Compression:

Stored size: 1.34 KB

Contents

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

    var generateMessage = function(count) {
            return I18n.t('workarea.admin.bulk_action_deletions.confirmation', { count: count });
        },

        getSessionCount = function($scope) {
            var session = WORKAREA.bulkActionItems.getSession(),
                $countUI = $('[data-bulk-action-item-count]', $scope);

            if (_.isNull(session)) { return $countUI.data('bulkActionItemCount'); }
            return session.count === 0 ? session.initialCount : session.count;
        },

        confirmBulkDelete = function($scope, event) {
            var count = getSessionCount($scope),
                threshold = WORKAREA.config.bulkActionDeletion.threshold,
                message = generateMessage(count);

            if (count < threshold && ! window.confirm(message)) {
                event.preventDefault();
                event.stopImmediatePropagation();
            }
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.bulkActionDeletion
         */
        init = function ($scope) {
            $('[data-bulk-action-deletion]', $scope)
            .on('submit', _.partial(confirmBulkDelete, $scope));
        };

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

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.5.15 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.36 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.14 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.35 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.13 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.34 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.12 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.33 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.11 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.10 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.32 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.9 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.31 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.8 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.30 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.7 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.29 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.6 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.28 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.5 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js