Sha256: c2c9337d75db1f3d44cbb596259e195e33b0bc5a8643258ace39300b1ed0240c

Contents?: true

Size: 895 Bytes

Versions: 62

Compression:

Stored size: 895 Bytes

Contents

// TODO: v4 deprecate in favor of jQuery UJS
/**
 * @namespace WORKAREA.singleSubmitForms
 */
WORKAREA.registerModule('singleSubmitForms', (function () {
    'use strict';

    var preventSubmission = function (event) {
            event.preventDefault();
        },

        preventFurtherSubmissionsIfValid = function (event) {
            var $form = $(event.currentTarget);

            if ($form.valid()) {
                $form
                .off('submit.singleSubmitForms')
                .on('submit', preventSubmission);
            }
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.singleSubmitForms
         */
        init = function ($scope) {
            $('[data-single-submit-form]', $scope)
            .on('submit.singleSubmitForms', preventFurtherSubmissionsIfValid);
        };

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

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.4.27 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.5.4 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.26 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.5.3 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.25 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.5.2 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.24 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.5.1 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.23 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.22 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.5.0 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.21 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.5.0.beta.1 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.20 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.19 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.18 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.17 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.16 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.15 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js
workarea-storefront-3.4.14 app/assets/javascripts/workarea/storefront/modules/single_submit_forms.js