Sha256: 35c567772e8b6e85a409cfdcd372c5a2250d920c206f0be44e4790d31c1971ed

Contents?: true

Size: 1.22 KB

Versions: 62

Compression:

Stored size: 1.22 KB

Contents

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

    var failsJQueryValidation = function ($form) {
            return ('valid' in $form) && (!$form.valid());
        },

        createDialog = function (event, options) {
            var $form = $(event.currentTarget),
                data = $form.data('dialogForm') || {};

            if (failsJQueryValidation($form)) { return; }

            event.preventDefault();

            options = options || data.dialogOptions || {};
            options.originatingElement = $form.get(0);

            WORKAREA.dialog.createFromForm($form, options);
        },

        /**
         * @method
         * @name initDialogForm
         * @memberof WORKAREA.dialogForms
         */
        initDialogForm = function (index, element, options) {
            $(element).on('submit', _.partialRight(createDialog, options));
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.dialogForms
         */
        init = function ($scope) {
            $('[data-dialog-form]', $scope).each(initDialogForm);
        };

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

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.5.27 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.5.26 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.4.45 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.5.25 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.5.23 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.4.44 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.5.22 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.4.43 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.5.21 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.4.42 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.5.20 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.4.41 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.5.19 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.4.40 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.5.18 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.4.39 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.5.17 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.4.38 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.5.16 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js
workarea-storefront-3.4.37 app/assets/javascripts/workarea/storefront/modules/dialog_forms.js