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 83 84 85 86 87 88 89 | 417x 417x 999x 999x 979x 979x 43x 936x 979x 15x 9x 9x 9x 9x 375x | 'use strict';
/**
* Redirect button
*
* @author Julien Sanchez <julien@akeneo.com>
* @copyright 2016 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',
'pim/form',
'routing',
'pim/router',
'pim/common/property',
'pim/template/form/redirect'
],
function ($, _, __, BaseForm, Routing, router, propertyAccessor, template) {
return BaseForm.extend({
template: _.template(template),
events: {
'click': 'redirect'
},
/**
* {@inheritdoc}
*/
initialize: function (config) {
this.config = config.config;
BaseForm.prototype.initialize.apply(this, arguments);
},
/**
* {@inheritdoc}
*/
render: function () {
this.isVisible().then(function (isVisible) {
if (!isVisible) {
return this;
}
this.$el.html(this.template({
label: __(this.config.label),
buttonClass: this.config.buttonClass || 'AknButton--action'
}));
}.bind(this));
return this;
},
/**
* Redirect to the route given in the config
*/
redirect: function () {
router.redirect(this.getUrl());
},
/**
* Get the route to redirect to
*
* @return {string}
*/
getUrl: function () {
var params = {};
Eif (this.config.identifier) {
params[this.config.identifier.name] = propertyAccessor.accessProperty(
this.getFormData(),
this.config.identifier.path
);
}
return Routing.generate(this.config.route, params);
},
/**
* Should this extension render
*
* @return {Promise}
*/
isVisible: function () {
return $.Deferred().resolve(true).promise();
}
});
}
);
|