-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from magento-fearless-kiwis/FearlessKiwis-MAG…
…ETWO-54779-Watermarks-cant-be-set-mainline [Fearless Kiwis] MAGETWO-54779: Watermarks cannot be set
- Loading branch information
Showing
4 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
define([ | ||
'jquery', | ||
'Magento_Ui/js/lib/validation/utils', | ||
'Magento_Ui/js/form/element/abstract', | ||
'Magento_Ui/js/lib/validation/validator' | ||
], function ($, utils, Abstract, validator) { | ||
'use strict'; | ||
|
||
validator.addRule( | ||
'validate-image-size-range', | ||
function (value) { | ||
var dataAttrRange = /^(\d+)x(\d+)$/, | ||
m; | ||
|
||
if (utils.isEmptyNoTrim(value)) { | ||
return true; | ||
} | ||
|
||
m = dataAttrRange.exec(value); | ||
|
||
return !!(m && m[1] > 0 && m[2] > 0); | ||
}, | ||
$.mage.__('This value does not follow the specified format (for example, 200X300).') | ||
); | ||
|
||
return Abstract.extend({ | ||
|
||
/** | ||
* Checks for relevant value | ||
* | ||
* @returns {Boolean} | ||
*/ | ||
isRangeCorrect: function () { | ||
return validator('validate-image-size-range', this.value()).passed; | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters