Skip to content

Commit

Permalink
MAGETWO-56849: Clean Up JS files code styles based on black list
Browse files Browse the repository at this point in the history
  • Loading branch information
omiroshnichenko committed Dec 20, 2016
1 parent 509af70 commit 391bf42
Show file tree
Hide file tree
Showing 117 changed files with 4,489 additions and 3,821 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*jshint browser:true jquery:true*/
/*global alert*/
var config = {

var config = { //eslint-disable-line no-unused-vars
config: {
mixins: {
'Magento_Checkout/js/action/place-order': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,31 @@
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*jshint browser:true jquery:true*/
/*global alert*/
define(
[
'jquery',
'mage/validation'
],
function ($) {
'use strict';
var checkoutConfig = window.checkoutConfig,
agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {},
agreementsInputPath = '.payment-method._active div.checkout-agreements input';

return {
/**
* Validate checkout agreements
*
* @returns {boolean}
*/
validate: function() {
if (!agreementsConfig.isEnabled || $(agreementsInputPath).length == 0) {
return true;
}
define([
'jquery',
'mage/validation'
], function ($) {
'use strict';

return $.validator.validateSingleElement(agreementsInputPath, {errorElement: 'div'});
var checkoutConfig = window.checkoutConfig,
agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {},
agreementsInputPath = '.payment-method._active div.checkout-agreements input';

return {
/**
* Validate checkout agreements
*
* @returns {Boolean}
*/
validate: function () {
if (!agreementsConfig.isEnabled || $(agreementsInputPath).length === 0) {
return true;
}

return $.validator.validateSingleElement(agreementsInputPath, {
errorElement: 'div'
});
}
}
);
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,46 @@
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*jshint browser:true jquery:true*/
/*global alert*/
define(
[
'jquery',
'Magento_Ui/js/modal/modal',
'mage/translate'
],
function ($, modal, $t) {
'use strict';
return {
modalWindow: null,

/** Create popUp window for provided element */
createModal: function(element) {
this.modalWindow = element;
var options = {
'type': 'popup',
'modalClass': 'agreements-modal',
'responsive': true,
'innerScroll': true,
'trigger': '.show-modal',
'buttons': [
{
text: $t('Close'),
class: 'action secondary action-hide-popup',
click: function() {
this.closeModal();
}
define([
'jquery',
'Magento_Ui/js/modal/modal',
'mage/translate'
], function ($, modal, $t) {
'use strict';

return {
modalWindow: null,

/** Create popUp window for provided element */
createModal: function (element) {
var options;

this.modalWindow = element;
options = {
'type': 'popup',
'modalClass': 'agreements-modal',
'responsive': true,
'innerScroll': true,
'trigger': '.show-modal',
'buttons': [
{
text: $t('Close'),
class: 'action secondary action-hide-popup',

/** @inheritdoc */
click: function () {
this.closeModal();
}
]
};
modal(options, $(this.modalWindow));
},
}
]
};
modal(options, $(this.modalWindow));
},

/** Show login popup window */
showModal: function() {
$(this.modalWindow).modal('openModal');
}
/** Show login popup window */
showModal: function () {
$(this.modalWindow).modal('openModal');
}
}
);
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*jshint browser:true jquery:true*/
/*global alert*/

define([
'jquery',
'mage/utils/wrapper',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define(
[
'uiComponent',
'Magento_Checkout/js/model/payment/additional-validators',
'Magento_CheckoutAgreements/js/model/agreement-validator'
],
function (Component, additionalValidators, agreementValidator) {
'use strict';
additionalValidators.registerValidator(agreementValidator);
return Component.extend({});
}
);

define([
'uiComponent',
'Magento_Checkout/js/model/payment/additional-validators',
'Magento_CheckoutAgreements/js/model/agreement-validator'
], function (Component, additionalValidators, agreementValidator) {
'use strict';

additionalValidators.registerValidator(agreementValidator);

return Component.extend({});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,56 @@
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define(
[
'ko',
'jquery',
'uiComponent',
'Magento_CheckoutAgreements/js/model/agreements-modal'
],
function (ko, $, Component, agreementsModal) {
'use strict';
var checkoutConfig = window.checkoutConfig,
agreementManualMode = 1,
agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {};

return Component.extend({
defaults: {
template: 'Magento_CheckoutAgreements/checkout/checkout-agreements'
},
isVisible: agreementsConfig.isEnabled,
agreements: agreementsConfig.agreements,
modalTitle: ko.observable(null),
modalContent: ko.observable(null),
modalWindow: null,
define([
'ko',
'jquery',
'uiComponent',
'Magento_CheckoutAgreements/js/model/agreements-modal'
], function (ko, $, Component, agreementsModal) {
'use strict';

/**
* Checks if agreement required
*
* @param element
*/
isAgreementRequired: function(element) {
return element.mode == agreementManualMode;
},
var checkoutConfig = window.checkoutConfig,
agreementManualMode = 1,
agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {};

/**
* Show agreement content in modal
*
* @param element
*/
showContent: function (element) {
this.modalTitle(element.checkboxText);
this.modalContent(element.content);
agreementsModal.showModal();
},
return Component.extend({
defaults: {
template: 'Magento_CheckoutAgreements/checkout/checkout-agreements'
},
isVisible: agreementsConfig.isEnabled,
agreements: agreementsConfig.agreements,
modalTitle: ko.observable(null),
modalContent: ko.observable(null),
modalWindow: null,

/**
* Init modal window for rendered element
*
* @param element
*/
initModal: function(element) {
agreementsModal.createModal(element);
}
});
}
);
/**
* Checks if agreement required
*
* @param {Object} element
*/
isAgreementRequired: function (element) {
return element.mode == agreementManualMode; //eslint-disable-line eqeqeq
},

/**
* Show agreement content in modal
*
* @param {Object} element
*/
showContent: function (element) {
this.modalTitle(element.checkboxText);
this.modalContent(element.content);
agreementsModal.showModal();
},

/**
* Init modal window for rendered element
*
* @param {Object} element
*/
initModal: function (element) {
agreementsModal.createModal(element);
}
});
});
4 changes: 2 additions & 2 deletions app/code/Magento/Cms/view/adminhtml/requirejs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* See COPYING.txt for license details.
*/

var config = {
var config = { //eslint-disable-line no-unused-vars
map: {
'*': {
folderTree: 'Magento_Cms/js/folder-tree'
}
}
};
};
Loading

0 comments on commit 391bf42

Please sign in to comment.