mod-build 3.6.0-beta.1 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/gulp-tasks/grab-cdn.js
CHANGED
|
@@ -21,7 +21,7 @@ function streamToDestination(gulp, siteSettings, inputPath, destPath, fileName)
|
|
|
21
21
|
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
22
22
|
return function() {
|
|
23
23
|
const { nodeEnv, isLocal } = siteSettings;
|
|
24
|
-
const { isQSPage, isWhiteLabel,
|
|
24
|
+
const { isQSPage, isWhiteLabel, domain } = siteData;
|
|
25
25
|
const isModWhiteLabel = isWhiteLabel && !isQSPage
|
|
26
26
|
const domainHasModernize = domain.indexOf('modernize') > -1;
|
|
27
27
|
|
package/gulp-tasks/templates.js
CHANGED
|
@@ -131,7 +131,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
131
131
|
'!' + siteSettings.srcFolder + '/' + siteSettings.templatesSubfolder + '/_partials/**/*.html'
|
|
132
132
|
])
|
|
133
133
|
.pipe(gulpPlugins.handlebarsFileInclude(templatesData, {
|
|
134
|
-
maxRecursion:
|
|
134
|
+
maxRecursion: 500,
|
|
135
135
|
handlebarsHelpers: handlebarsHelpers
|
|
136
136
|
}))
|
|
137
137
|
.pipe(gulp.dest(siteSettings.tmpFolder));
|
package/package.json
CHANGED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/* exported contactUs */
|
|
2
|
-
|
|
3
|
-
var contactUs = {
|
|
4
|
-
$form: $('.contact-us__form'),
|
|
5
|
-
$thankyou: $('.contact-us__thankyou'),
|
|
6
|
-
url: 'https://contact.formfetch.com/v2_submit',
|
|
7
|
-
getFormData: function() {
|
|
8
|
-
const date = new Date();
|
|
9
|
-
const data = {};
|
|
10
|
-
this.$form.serializeArray().forEach(function(input) {
|
|
11
|
-
data[input.name] = input.value;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
data.time = date.toLocaleTimeString();
|
|
15
|
-
data.date = date.toLocaleDateString();
|
|
16
|
-
return data;
|
|
17
|
-
},
|
|
18
|
-
validateData: function(data) {
|
|
19
|
-
const _this = this;
|
|
20
|
-
var isFormValid = true;
|
|
21
|
-
const emailPattern = /^([\w\+-]+(?:\.[\w\+-]+)*)(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)/i;
|
|
22
|
-
|
|
23
|
-
Object.keys(data).forEach(function(key) {
|
|
24
|
-
var isValid = true;
|
|
25
|
-
const value = data[key];
|
|
26
|
-
switch (key) {
|
|
27
|
-
case 'email':
|
|
28
|
-
isValid = emailPattern.test(value);
|
|
29
|
-
break;
|
|
30
|
-
default:
|
|
31
|
-
isValid = value !== '';
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (!isValid) {
|
|
36
|
-
_this.markFieldAsInvalid(key);
|
|
37
|
-
isFormValid = false;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return isFormValid;
|
|
42
|
-
},
|
|
43
|
-
markFieldAsInvalid: function(fieldName) {
|
|
44
|
-
this.$form.find('#' + fieldName).parent().addClass('has-error');
|
|
45
|
-
},
|
|
46
|
-
submit: function() {
|
|
47
|
-
this.$form.addClass('form--loading');
|
|
48
|
-
|
|
49
|
-
const _this = this;
|
|
50
|
-
const data = this.getFormData();
|
|
51
|
-
const isFormValid = this.validateData(data);
|
|
52
|
-
|
|
53
|
-
if (isFormValid) {
|
|
54
|
-
// Submit
|
|
55
|
-
$.ajax({
|
|
56
|
-
url: _this.url,
|
|
57
|
-
dataType: 'json',
|
|
58
|
-
type: 'post',
|
|
59
|
-
crossDomain: true,
|
|
60
|
-
data: data,
|
|
61
|
-
success: function(response) {
|
|
62
|
-
if (response.success) {
|
|
63
|
-
_this.$form.hide();
|
|
64
|
-
_this.$thankyou.show();
|
|
65
|
-
} else {
|
|
66
|
-
_this.$form.removeClass('form--loading');
|
|
67
|
-
$('.step__error').html(response.message);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
} else {
|
|
72
|
-
_this.$form.removeClass('form--loading');
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
changeStep: function(direction) {
|
|
76
|
-
const $activeStep = this.$form.find('.step--active');
|
|
77
|
-
const $nextStep = $activeStep.next();
|
|
78
|
-
const $prevStep = $activeStep.prev();
|
|
79
|
-
|
|
80
|
-
$activeStep.removeClass('step--active');
|
|
81
|
-
if (direction === 'next') {
|
|
82
|
-
$nextStep.addClass('step--active');
|
|
83
|
-
} else {
|
|
84
|
-
$prevStep.addClass('step--active');
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
watch: function() {
|
|
88
|
-
const _this = this;
|
|
89
|
-
|
|
90
|
-
// Watch form submission
|
|
91
|
-
_this.$form.on('submit', function(e) {
|
|
92
|
-
e.preventDefault();
|
|
93
|
-
if (!$(this).hasClass('form--loading')) {
|
|
94
|
-
_this.submit();
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// Watch radio click
|
|
99
|
-
$('input[type="radio"]').on('change', function() {
|
|
100
|
-
_this.changeStep('next');
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// Watch back button
|
|
104
|
-
_this.$form.find('.btn-back').on('click', function() {
|
|
105
|
-
_this.changeStep('prev');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// Remove error state when input/textarea changes
|
|
109
|
-
_this.$form.find('input, textarea').on('change', function() {
|
|
110
|
-
$(this).parent().removeClass('has-error');
|
|
111
|
-
});
|
|
112
|
-
},
|
|
113
|
-
init: function() {
|
|
114
|
-
this.watch();
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
(function($) {
|
|
119
|
-
$(document).ready(function() {
|
|
120
|
-
contactUs.init();
|
|
121
|
-
});
|
|
122
|
-
})(jQuery);
|