Skip to content

Commit

Permalink
Refactor JavsScript for UrlRewrite module edit page
Browse files Browse the repository at this point in the history
  • Loading branch information
patelnimesh1988 authored and vijay-wagento committed Jun 4, 2018
1 parent 943e2cd commit 6711694
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
17 changes: 8 additions & 9 deletions app/code/Magento/UrlRewrite/view/adminhtml/templates/edit.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
?>
<?= $block->getChildHtml() ?>
<?php if ($block->getChildBlock('form')): ?>
<script>
require([
'jquery',
'mage/backend/form',
'mage/backend/validation'
], function($){
$('#edit_form').form()
.validation({validationUrl: '<?= $block->escapeUrl($block->getValidationUrl()) ?>'});
});
<script type="text/x-magento-init">
{
"#edit_form": {
"Magento_UrlRewrite/js/url-rewrite-validation" : {
"url": "<?= $block->escapeUrl($block->getValidationUrl()) ?>"
}
}
}
</script>
<?php endif; ?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

define([
'jquery',
'mage/backend/form',
'mage/backend/validation'
], function ($) {
'use strict';

return function (data, element) {

$(element).form().validation({
validationUrl: data.url
});
};
});

0 comments on commit 6711694

Please sign in to comment.