Skip to content

Commit 509fd9d

Browse files
author
vpaladiychuk
committed
MAGETWO-50396: Is Default checkbox is not selected if Dropdown frontend input is selected in New Attribute form
1 parent ae33eab commit 509fd9d

File tree

1 file changed

+87
-87
lines changed
  • app/code/Magento/Catalog/view/adminhtml/web/js/form/element

1 file changed

+87
-87
lines changed
Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
1-
/**
2-
* Copyright © 2015 Magento. All rights reserved.
3-
* See COPYING.txt for license details.
4-
*/
5-
6-
define([
7-
'Magento_Ui/js/form/element/single-checkbox'
8-
], function (Checkbox) {
9-
'use strict';
10-
11-
return Checkbox.extend({
12-
defaults: {
13-
inputCheckBoxName: '',
14-
prefixElementName: '',
15-
parentDynamicRowName: 'visual_swatch'
16-
},
17-
18-
/**
19-
* Parses options and merges the result with instance
20-
*
21-
* @returns {Object} Chainable.
22-
*/
23-
initConfig: function () {
24-
this._super();
25-
this.configureDataScope();
26-
27-
return this;
28-
},
29-
30-
/** @inheritdoc */
31-
initialize: function () {
32-
this._super();
33-
34-
if (this.rows && this.rows().elems().length === 1) {
35-
this.checked(true);
36-
}
37-
38-
return this;
39-
},
40-
41-
/**
42-
* Configure data scope.
43-
*/
44-
configureDataScope: function () {
45-
var recordId,
46-
value;
47-
48-
recordId = this.parentName.split('.').last();
49-
value = this.prefixElementName + recordId;
50-
51-
this.dataScope = 'data.' + this.inputCheckBoxName;
52-
this.inputName = this.dataScopeToHtmlArray(this.inputCheckBoxName);
53-
54-
this.initialValue = value;
55-
56-
this.links.value = this.provider + ':' + this.dataScope;
57-
},
58-
59-
/**
60-
* Get HTML array from data scope.
61-
*
62-
* @param {String} dataScopeString
63-
* @returns {String}
64-
*/
65-
dataScopeToHtmlArray: function (dataScopeString) {
66-
var dataScopeArray, dataScope, reduceFunction;
67-
68-
/**
69-
* Add new level of nesting.
70-
*
71-
* @param {String} prev
72-
* @param {String} curr
73-
* @returns {String}
74-
*/
75-
reduceFunction = function (prev, curr) {
76-
return prev + '[' + curr + ']';
77-
};
78-
79-
dataScopeArray = dataScopeString.split('.');
80-
81-
dataScope = dataScopeArray.shift();
82-
dataScope += dataScopeArray.reduce(reduceFunction, '');
83-
84-
return dataScope;
85-
}
86-
});
87-
});
1+
/**
2+
* Copyright © 2015 Magento. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'Magento_Ui/js/form/element/single-checkbox'
8+
], function (Checkbox) {
9+
'use strict';
10+
11+
return Checkbox.extend({
12+
defaults: {
13+
inputCheckBoxName: '',
14+
prefixElementName: '',
15+
parentDynamicRowName: 'visual_swatch'
16+
},
17+
18+
/**
19+
* Parses options and merges the result with instance
20+
*
21+
* @returns {Object} Chainable.
22+
*/
23+
initConfig: function () {
24+
this._super();
25+
this.configureDataScope();
26+
27+
return this;
28+
},
29+
30+
/** @inheritdoc */
31+
initialize: function () {
32+
this._super();
33+
34+
if (this.rows && this.rows().elems().length === 0) {
35+
this.checked(true);
36+
}
37+
38+
return this;
39+
},
40+
41+
/**
42+
* Configure data scope.
43+
*/
44+
configureDataScope: function () {
45+
var recordId,
46+
value;
47+
48+
recordId = this.parentName.split('.').last();
49+
value = this.prefixElementName + recordId;
50+
51+
this.dataScope = 'data.' + this.inputCheckBoxName;
52+
this.inputName = this.dataScopeToHtmlArray(this.inputCheckBoxName);
53+
54+
this.initialValue = value;
55+
56+
this.links.value = this.provider + ':' + this.dataScope;
57+
},
58+
59+
/**
60+
* Get HTML array from data scope.
61+
*
62+
* @param {String} dataScopeString
63+
* @returns {String}
64+
*/
65+
dataScopeToHtmlArray: function (dataScopeString) {
66+
var dataScopeArray, dataScope, reduceFunction;
67+
68+
/**
69+
* Add new level of nesting.
70+
*
71+
* @param {String} prev
72+
* @param {String} curr
73+
* @returns {String}
74+
*/
75+
reduceFunction = function (prev, curr) {
76+
return prev + '[' + curr + ']';
77+
};
78+
79+
dataScopeArray = dataScopeString.split('.');
80+
81+
dataScope = dataScopeArray.shift();
82+
dataScope += dataScopeArray.reduce(reduceFunction, '');
83+
84+
return dataScope;
85+
}
86+
});
87+
});

0 commit comments

Comments
 (0)