Skip to content

Commit 0afa829

Browse files
author
Hwashiang Yu
committed
MC-17807: Store name rendering in customer section
- Resolved template issue for store name in customer admin section - Updated unit test for related issue
1 parent 5517446 commit 0afa829

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

app/code/Magento/Store/Model/System/Store.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ public function getStoreValuesForForm($empty = false, $all = false)
152152
}
153153
}
154154
}
155+
array_walk(
156+
$options,
157+
function (&$item) {
158+
$item['__disableTmpl'] = true;
159+
}
160+
);
155161
return $options;
156162
}
157163

app/code/Magento/Store/Test/Unit/Model/System/StoreTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,15 @@ public function getStoreValuesForFormDataProvider()
262262
'storeGroupId' => $groupId,
263263
'groupWebsiteId' => $websiteId,
264264
'expectedResult' => [
265-
['label' => '', 'value' => ''],
266-
['label' => __('All Store Views'), 'value' => 0],
267-
['label' => $websiteName, 'value' => []],
265+
['label' => '', 'value' => '','__disableTmpl' => true],
266+
['label' => __('All Store Views'), 'value' => 0,'__disableTmpl' => true],
267+
['label' => $websiteName, 'value' => [],'__disableTmpl' => true],
268268
[
269269
'label' => str_repeat($nonEscapableNbspChar, 4) . $groupName,
270270
'value' => [
271271
['label' => str_repeat($nonEscapableNbspChar, 4) . $storeName, 'value' => $storeId]
272-
]
272+
],
273+
'__disableTmpl' => true
273274
],
274275
]
275276
],

app/code/Magento/Ui/view/base/web/js/grid/editing/record.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ define([
134134

135135
field = utils.extend({}, fields.base, field);
136136

137+
field.__disableTmpl = {
138+
label: true,
139+
options: true
140+
};
141+
137142
return utils.template(field, {
138143
record: this,
139144
column: column

app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/optgroup.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,14 @@ define([
222222
ko.utils.setTextContent(option, allBindings.get('optionsCaption'));
223223
ko.selectExtensions.writeValue(option, undefined);
224224
} else if (typeof arrayEntry[optionsValue] === 'undefined') { // empty value === optgroup
225-
option = utils.template(optgroupTmpl, {
226-
label: arrayEntry[optionsText],
227-
title: arrayEntry[optionsText + 'title']
228-
});
225+
if (arrayEntry['__disableTmpl']) {
226+
option = '<optgroup label="' + arrayEntry[optionsText] + '"></optgroup>';
227+
} else {
228+
option = utils.template(optgroupTmpl, {
229+
label: arrayEntry[optionsText],
230+
title: arrayEntry[optionsText + 'title']
231+
});
232+
}
229233
option = ko.utils.parseHtmlFragment(option)[0];
230234

231235
} else {
@@ -307,6 +311,10 @@ define([
307311
obj.disabled = disabled;
308312
}
309313

314+
if ("__disableTmpl" in option) {
315+
obj.__disableTmpl = option.__disableTmpl;
316+
}
317+
310318
label = label.replace(nbspRe, '').trim();
311319

312320
if (Array.isArray(value)) {

0 commit comments

Comments
 (0)