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.27 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.26 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.45 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.25 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.23 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.44 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.22 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.43 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.21 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.42 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.20 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.41 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.19 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.40 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.18 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.39 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.17 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.38 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.5.16 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js
workarea-admin-3.4.37 app/assets/javascripts/workarea/admin/modules/bulk_action_deletion.js