Skip to content

Commit 59d7662

Browse files
author
Volodymyr Zaets
committed
Merge remote-tracking branch 'origin/MAGETWO-44340' into PR
2 parents 02e0378 + ddbc07e commit 59d7662

File tree

3 files changed

+45
-20
lines changed

3 files changed

+45
-20
lines changed

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/** @var $block \Magento\Swatches\Block\Adminhtml\Attribute\Edit\Options\Text */
1010
?>
11-
<fieldset class="fieldset ignore-validate">
11+
<fieldset class="fieldset">
1212
<legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Manage Swatch (values of your attribute)') ?></span></legend>
1313
<div id="swatch-text-options-panel">
1414
<?php //@todo move style to css file ?>
@@ -33,16 +33,23 @@
3333
<th class="col-delete">&nbsp;</th>
3434
</tr>
3535
</thead>
36-
<tbody data-role="swatch-text-options-container"></tbody>
36+
<tbody data-role="swatch-text-options-container" class="ignore-validate"></tbody>
3737
<tfoot>
38-
<th colspan="<?php /* @escapeNotVerified */ echo $storetotal; ?>" class="col-actions-add">
39-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
40-
<button id="add_new_swatch_text_option_button" title="<?php /* @escapeNotVerified */ echo __('Add Swatch'); ?>"
41-
type="button" class="action- scalable add">
42-
<span><?php /* @escapeNotVerified */ echo __('Add Swatch'); ?></span>
43-
</button>
44-
<?php endif; ?>
45-
</th>
38+
<tr>
39+
<th colspan="<?php /* @escapeNotVerified */ echo $storetotal; ?>">
40+
<input type="hidden" class="required-swatch-entry"/>
41+
</th>
42+
</tr>
43+
<tr>
44+
<th colspan="<?php /* @escapeNotVerified */ echo $storetotal; ?>" class="col-actions-add">
45+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
46+
<button id="add_new_swatch_text_option_button" title="<?php /* @escapeNotVerified */ echo __('Add Swatch'); ?>"
47+
type="button" class="action- scalable add">
48+
<span><?php /* @escapeNotVerified */ echo __('Add Swatch'); ?></span>
49+
</button>
50+
<?php endif; ?>
51+
</th>
52+
</tr>
4653
</tfoot>
4754
</table>
4855
<input type="hidden" id="swatch-text-option-count-check" value="" />

app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/** @var $block \Magento\Swatches\Block\Adminhtml\Attribute\Edit\Options\Visual */
1010
?>
11-
<fieldset class="fieldset ignore-validate">
11+
<fieldset class="fieldset">
1212
<legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Manage Swatch (values of your attribute)') ?></span></legend>
1313
<div id="swatch-visual-options-panel">
1414
<?php //@todo move style to css file ?>
@@ -29,16 +29,23 @@
2929
<th class="col-delete">&nbsp;</th>
3030
</tr>
3131
</thead>
32-
<tbody data-role="swatch-visual-options-container"></tbody>
32+
<tbody data-role="swatch-visual-options-container" class="ignore-validate"></tbody>
3333
<tfoot>
34-
<th colspan="<?php /* @escapeNotVerified */ echo $storetotal; ?>" class="col-actions-add">
35-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
36-
<button id="add_new_swatch_visual_option_button" title="<?php /* @escapeNotVerified */ echo __('Add Swatch'); ?>"
37-
type="button" class="action- scalable add">
38-
<span><?php /* @escapeNotVerified */ echo __('Add Swatch'); ?></span>
39-
</button>
40-
<?php endif; ?>
41-
</th>
34+
<tr>
35+
<th colspan="<?php /* @escapeNotVerified */ echo $storetotal; ?>">
36+
<input type="hidden" class="required-swatch-entry"/>
37+
</th>
38+
</tr>
39+
<tr>
40+
<th colspan="<?php /* @escapeNotVerified */ echo $storetotal; ?>" class="col-actions-add">
41+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
42+
<button id="add_new_swatch_visual_option_button" title="<?php /* @escapeNotVerified */ echo __('Add Swatch'); ?>"
43+
type="button" class="action- scalable add">
44+
<span><?php /* @escapeNotVerified */ echo __('Add Swatch'); ?></span>
45+
</button>
46+
<?php endif; ?>
47+
</th>
48+
</tr>
4249
</tfoot>
4350
</table>
4451
<input type="hidden" id="swatch-visual-option-count-check" value="" />

lib/web/mage/validation.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,17 @@
12241224
},
12251225
'Please enter a valid number.'
12261226
],
1227+
'required-swatch-entry': [
1228+
function (value, element) {
1229+
var empty = $(element).closest('table')
1230+
.find('input.required-option')
1231+
.filter(function(i, el){
1232+
return $.mage.isEmpty(el.value);
1233+
})
1234+
.length;
1235+
return empty === 0;
1236+
}, 'Admin is a required field in the each row.'
1237+
],
12271238
'validate-item-quantity': [
12281239
function (value, element, params) {
12291240
// obtain values for validation

0 commit comments

Comments
 (0)