Skip to content

Commit e78ea61

Browse files
magento#12294: Bug: Adding Custom Attribute - The value of Admin scope can't
be empty
1 parent 288d0d4 commit e78ea61

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ $stores = $block->getStoresSortedBySortOrder();
5757
<input type="hidden" id="option-count-check" value="" />
5858
</div>
5959
<script id="row-template" type="text/x-magento-template">
60-
<tr>
60+
<tr <% if (data.rowClasses) { %>class="<%- data.rowClasses %>"<% } %>>
6161
<td class="col-draggable">
6262
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
6363
<div data-role="draggable-handle" class="draggable-handle"

app/code/Magento/Catalog/view/adminhtml/web/js/options.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ define([
2424
totalItems: 0,
2525
rendered: 0,
2626
template: mageTemplate('#row-template'),
27+
newOptionClass: 'new-option',
2728
isReadOnly: config.isReadOnly,
2829
add: function (data, render) {
2930
var isNewOption = false,
@@ -32,7 +33,8 @@ define([
3233
if (typeof data.id == 'undefined') {
3334
data = {
3435
'id': 'option_' + this.itemCount,
35-
'sort_order': this.itemCount + 1
36+
'sort_order': this.itemCount + 1,
37+
'rowClasses': this.newOptionClass
3638
};
3739
isNewOption = true;
3840
}
@@ -81,12 +83,13 @@ define([
8183
element.addClassName('no-display');
8284
element.addClassName('template');
8385
element.hide();
84-
jQuery(element).find('input').each(function(index, el) {
85-
el.disabled = 'disabled';
86-
});
8786
this.totalItems--;
8887
this.updateItemsCountField();
8988
}
89+
90+
if (element.hasClassName(this.newOptionClass)) {
91+
element.remove();
92+
}
9093
},
9194
updateItemsCountField: function () {
9295
$('option-count-check').value = this.totalItems > 0 ? '1' : '';

0 commit comments

Comments
 (0)