Skip to content

Commit

Permalink
Merge forwardport of #12755 to 2.3-develop branch
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
magento-engcom-team committed Jan 24, 2018
2 parents 898a470 + 7f42a67 commit c99c3a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ $stores = $block->getStoresSortedBySortOrder();
<input type="hidden" id="option-count-check" value="" />
</div>
<script id="row-template" type="text/x-magento-template">
<tr>
<tr <% if (data.rowClasses) { %>class="<%- data.rowClasses %>"<% } %>>
<td class="col-draggable">
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
<div data-role="draggable-handle" class="draggable-handle"
Expand Down
8 changes: 7 additions & 1 deletion app/code/Magento/Catalog/view/adminhtml/web/js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ define([
totalItems: 0,
rendered: 0,
template: mageTemplate('#row-template'),
newOptionClass: 'new-option',
isReadOnly: config.isReadOnly,
add: function (data, render) {
var isNewOption = false,
Expand All @@ -32,7 +33,8 @@ define([
if (typeof data.id == 'undefined') {
data = {
'id': 'option_' + this.itemCount,
'sort_order': this.itemCount + 1
'sort_order': this.itemCount + 1,
'rowClasses': this.newOptionClass
};
isNewOption = true;
}
Expand Down Expand Up @@ -84,6 +86,10 @@ define([
this.totalItems--;
this.updateItemsCountField();
}

if (element.hasClassName(this.newOptionClass)) {
element.remove();
}
},
updateItemsCountField: function () {
$('option-count-check').value = this.totalItems > 0 ? '1' : '';
Expand Down

0 comments on commit c99c3a7

Please sign in to comment.