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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | 61x 61x 14x 14x 14x 2x 2x 2x 3x 1x 1x | 'use strict';
/**
* Button that handles the opening of the "create new family variant" modal.
*
* @author Adrien Pétremann <adrien.petremann@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(
[
'jquery',
'underscore',
'oro/translator',
'oro/messenger',
'pim/form',
'pim/form-modal'
],
function(
$,
_,
__,
messenger,
BaseForm,
FormModal
) {
return BaseForm.extend({
className: 'AknButton AknButton--action AknButton--small add-variant',
modal: null,
events: {
'click': 'openModal'
},
/**
* {@inheritdoc}
*/
render() {
this.$el.html(__('pim_enrich.entity.family_variant.module.create.label'));
this.delegateEvents();
return BaseForm.prototype.render.apply(this, arguments);
},
/**
* Open the modal containing the form to create a new family variant.
*/
openModal() {
const modalParameters = {
className: 'modal modal--fullPage add-family-variant-modal',
content: '',
cancelText: __('pim_common.cancel'),
okText: __('pim_common.create'),
okCloses: false
};
const formModal = new FormModal(
'pim-family-variant-create-form',
this.submitForm.bind(this),
modalParameters,
{family: this.getFormData().code}
);
formModal.open();
},
/**
* Action made when user submit the modal.
*/
submitForm(formModal) {
return formModal.saveFamilyVariant()
.then((familyVariant) => {
messenger.notify(
'success',
_.__('pim_enrich.entity.family_variant.flash.create.success')
);
this.getRoot().trigger('pim_enrich.entity.family.family_variant.post_create', familyVariant);
});
}
});
}
);
|