Skip to content

Commit c99c3a7

Browse files
Merge forwardport of #12755 to 2.3-develop branch
Applied pull request patch https://github.com/magento/magento2/pull/12755.patch (created by @virtual97) based on commit(s): 1. 2ccb374 2. 288d0d4 3. e78ea61 Fixed GitHub Issues in 2.3-develop branch: - #12294: Bug: Adding Custom Attribute - The value of Admin scope can't be empty (reported by @webscot)
2 parents 898a470 + 7f42a67 commit c99c3a7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
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 & 1 deletion
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
}
@@ -84,6 +86,10 @@ define([
8486
this.totalItems--;
8587
this.updateItemsCountField();
8688
}
89+
90+
if (element.hasClassName(this.newOptionClass)) {
91+
element.remove();
92+
}
8793
},
8894
updateItemsCountField: function () {
8995
$('option-count-check').value = this.totalItems > 0 ? '1' : '';

0 commit comments

Comments
 (0)