Skip to content

Commit

Permalink
magento#12294: Bug: Adding Custom Attribute - The value of Admin scop…
Browse files Browse the repository at this point in the history
…e can't

be empty
  • Loading branch information
omiroshnichenko committed Jan 2, 2018
1 parent 288d0d4 commit e78ea61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 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
11 changes: 7 additions & 4 deletions 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 @@ -81,12 +83,13 @@ define([
element.addClassName('no-display');
element.addClassName('template');
element.hide();
jQuery(element).find('input').each(function(index, el) {
el.disabled = 'disabled';
});
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 e78ea61

Please sign in to comment.