Skip to content
Snippets Groups Projects
Commit e78ea61c authored by Oleksandr Miroshnichenko's avatar Oleksandr Miroshnichenko
Browse files

magento/magento2#12294: Bug: Adding Custom Attribute - The value of Admin scope can't

be empty
parent 288d0d47
Branches
No related merge requests found
...@@ -57,7 +57,7 @@ $stores = $block->getStoresSortedBySortOrder(); ...@@ -57,7 +57,7 @@ $stores = $block->getStoresSortedBySortOrder();
<input type="hidden" id="option-count-check" value="" /> <input type="hidden" id="option-count-check" value="" />
</div> </div>
<script id="row-template" type="text/x-magento-template"> <script id="row-template" type="text/x-magento-template">
<tr> <tr <% if (data.rowClasses) { %>class="<%- data.rowClasses %>"<% } %>>
<td class="col-draggable"> <td class="col-draggable">
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?> <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?>
<div data-role="draggable-handle" class="draggable-handle" <div data-role="draggable-handle" class="draggable-handle"
......
...@@ -24,6 +24,7 @@ define([ ...@@ -24,6 +24,7 @@ define([
totalItems: 0, totalItems: 0,
rendered: 0, rendered: 0,
template: mageTemplate('#row-template'), template: mageTemplate('#row-template'),
newOptionClass: 'new-option',
isReadOnly: config.isReadOnly, isReadOnly: config.isReadOnly,
add: function (data, render) { add: function (data, render) {
var isNewOption = false, var isNewOption = false,
...@@ -32,7 +33,8 @@ define([ ...@@ -32,7 +33,8 @@ define([
if (typeof data.id == 'undefined') { if (typeof data.id == 'undefined') {
data = { data = {
'id': 'option_' + this.itemCount, 'id': 'option_' + this.itemCount,
'sort_order': this.itemCount + 1 'sort_order': this.itemCount + 1,
'rowClasses': this.newOptionClass
}; };
isNewOption = true; isNewOption = true;
} }
...@@ -81,12 +83,13 @@ define([ ...@@ -81,12 +83,13 @@ define([
element.addClassName('no-display'); element.addClassName('no-display');
element.addClassName('template'); element.addClassName('template');
element.hide(); element.hide();
jQuery(element).find('input').each(function(index, el) {
el.disabled = 'disabled';
});
this.totalItems--; this.totalItems--;
this.updateItemsCountField(); this.updateItemsCountField();
} }
if (element.hasClassName(this.newOptionClass)) {
element.remove();
}
}, },
updateItemsCountField: function () { updateItemsCountField: function () {
$('option-count-check').value = this.totalItems > 0 ? '1' : ''; $('option-count-check').value = this.totalItems > 0 ? '1' : '';
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment