All files / web/bundles/pimui/js/controller/attribute-group create.js

90% Statements 9/10
50% Branches 1/2
100% Functions 4/4
90% Lines 9/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44                  4x             4x         4x       4x   4x 2x   4x         4x   4x            
'use strict';
 
/**
 * Attribute group create controller
 *
 * @author    Julien Sanchez <julien@akeneo.com>
 * @copyright 2017 Akeneo SAS (http://www.akeneo.com)
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
define(
    [
        'underscore',
        'pim/controller/front',
        'pim/form-builder'
    ],
    function (_, BaseController, FormBuilder) {
        return BaseController.extend({
            /**
             * {@inheritdoc}
             */
            renderForm: function () {
                Iif (!this.active) {
                    return;
                }
 
                return FormBuilder.build('pim-attribute-group-create-form')
                    .then((form) => {
                        this.on('pim:controller:can-leave', function (event) {
                            form.trigger('pim_enrich:form:can-leave', event);
                        });
                        form.setData({
                            code: '',
                            labels: {}
                        });
 
                        form.setElement(this.$el).render();
 
                        return form;
                    });
            }
        });
    }
);