hoodcms 5.0.13 → 6.0.0
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/dist/css/login.css +1 -1
- package/dist/js/admin.js +24 -6
- package/dist/js/app.js +12 -6
- package/dist/js/app.property.js +24 -0
- package/dist/js/core/HoodApi.d.ts +17 -7
- package/dist/js/core/HoodApi.js +71 -10
- package/dist/js/core/Validator.js +1 -1
- package/dist/js/index.d.ts +0 -1
- package/dist/js/index.js +0 -1
- package/dist/js/login.js +2 -2
- package/images/hood-small.png +0 -0
- package/images/hood.png +0 -0
- package/package.json +108 -108
- package/src/css/admin.css +0 -3
- package/src/css/admin.css.map +1 -1
- package/src/css/app.css +0 -3
- package/src/css/app.css.map +1 -1
- package/src/css/login.css +165 -0
- package/src/css/login.css.map +1 -1
- package/src/html/auth0/login.html +100 -0
- package/src/html/auth0/passwordless-email.html +184 -0
- package/src/js/admin.js +42774 -1161
- package/src/js/admin.js.map +1 -1
- package/src/js/app.js +30296 -833
- package/src/js/app.js.map +1 -1
- package/src/js/app.property.js +1123 -0
- package/src/js/app.property.js.map +1 -0
- package/src/js/login.js +2 -2
- package/src/scss/core/_images.scss +48 -48
- package/src/scss/login.scss +1 -0
- package/src/ts/admin.ts +3 -0
- package/src/ts/app.property.ts +21 -0
- package/src/ts/app.ts +3 -81
- package/src/ts/core/Google.ts +0 -0
- package/src/ts/core/HoodApi.ts +96 -14
- package/src/ts/core/Validator.ts +1 -1
- package/src/ts/index.ts +0 -1
- package/temp.txt +1 -0
- package/dist/js/core/BaseSite.d.ts +0 -6
- package/dist/js/core/BaseSite.js +0 -14
- package/src/ts/core/BaseSite.ts +0 -21
package/src/ts/core/HoodApi.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
/// <reference types="google.maps" />
|
|
2
|
+
|
|
3
|
+
import { Response, Validator } from "..";
|
|
4
|
+
import { Alerts } from "./Alerts";
|
|
4
5
|
import { Handlers } from "./Handlers";
|
|
5
|
-
import { MediaModal } from "./Media";
|
|
6
6
|
import { Uploader } from "./Uploader";
|
|
7
7
|
|
|
8
8
|
declare global {
|
|
@@ -17,22 +17,104 @@ declare global {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Base class for extending a Hood CMS website, ensure you call HoodApi.initialise() to setup loaders and contact form defaults.
|
|
22
|
+
*/
|
|
23
|
+
export class HoodApi {
|
|
21
24
|
alerts: Alerts = new Alerts();
|
|
22
|
-
uploader: Uploader = new Uploader();
|
|
23
25
|
handlers: Handlers = new Handlers();
|
|
24
|
-
|
|
25
|
-
colorPickers: ColorPickers = new ColorPickers();
|
|
26
|
-
|
|
27
|
-
private mediaModal: MediaModal = new MediaModal();
|
|
26
|
+
uploader: Uploader = new Uploader();
|
|
28
27
|
|
|
29
28
|
constructor() {
|
|
30
|
-
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Initialise Hood CMS site defaults, can be overridden or individual setup items can be called instead of the initialise function.
|
|
32
|
+
initialise() {
|
|
33
|
+
// Initialise loaders (default, adds loading to body tag)
|
|
31
34
|
this.setupLoaders();
|
|
35
|
+
|
|
36
|
+
// Hook up default handlers.
|
|
37
|
+
this.handlers.initDefaultHandlers();
|
|
38
|
+
|
|
39
|
+
// Init hood contact forms.
|
|
40
|
+
this.initContactForms();
|
|
32
41
|
}
|
|
33
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Default Hood CMS loaders, can be used however, this simply adds a "loading" class to the body tag on show/hide.
|
|
45
|
+
*/
|
|
34
46
|
setupLoaders(): void {
|
|
35
|
-
$('body').on('loader-show', function () {
|
|
36
|
-
$('body').on('loader-hide', function () {
|
|
47
|
+
$('body').on('loader-show', function () { document.body.classList.add('loading') })
|
|
48
|
+
$('body').on('loader-hide', function () { document.body.classList.remove('loading') })
|
|
37
49
|
}
|
|
38
|
-
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Default initialisation function for Google Maps, should be called as the callback from the Google Maps API script tag.
|
|
53
|
+
*/
|
|
54
|
+
initGoogleMaps(tag: string = '.google-map') {
|
|
55
|
+
|
|
56
|
+
$(tag).each(function () {
|
|
57
|
+
|
|
58
|
+
var myLatLng = new google.maps.LatLng($(this).data('lat'), $(this).data('long'));
|
|
59
|
+
|
|
60
|
+
console.log('Loading map at: ' + $(this).data('lat') + ', ' + $(this).data('long'));
|
|
61
|
+
|
|
62
|
+
var map = new google.maps.Map(this, {
|
|
63
|
+
zoom: $(this).data('zoom') || 15,
|
|
64
|
+
center: myLatLng,
|
|
65
|
+
scrollwheel: false
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
var marker = new google.maps.Marker({
|
|
69
|
+
position: myLatLng,
|
|
70
|
+
map: map,
|
|
71
|
+
title: $(this).data('marker')
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
$(window).on('resize', function () {
|
|
75
|
+
google.maps.event.trigger(map, 'resize');
|
|
76
|
+
});
|
|
77
|
+
google.maps.event.trigger(map, 'resize');
|
|
78
|
+
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Initialisation function for contact forms on the site, will add validator, and submit/functionality to any forms matching the given tag selector string.
|
|
85
|
+
*/
|
|
86
|
+
initContactForms(tag: string = '.contact-form') {
|
|
87
|
+
|
|
88
|
+
let $form = $(tag);
|
|
89
|
+
|
|
90
|
+
$form.find('.thank-you').hide();
|
|
91
|
+
$form.find('.form-content').show();
|
|
92
|
+
|
|
93
|
+
let form: HTMLFormElement = $(tag)[0] as HTMLFormElement;
|
|
94
|
+
new Validator(form, {
|
|
95
|
+
onComplete: function (this: HoodApi, response: Response) {
|
|
96
|
+
if (response.success) {
|
|
97
|
+
|
|
98
|
+
if ($form.attr('data-redirect'))
|
|
99
|
+
window.location.href = $form.attr('data-redirect');
|
|
100
|
+
|
|
101
|
+
if ($form.attr('data-alert-message'))
|
|
102
|
+
Alerts.success($form.attr('data-alert-message'));
|
|
103
|
+
|
|
104
|
+
$form.find('.form').hide();
|
|
105
|
+
$form.find('.thank-you').show();
|
|
106
|
+
} else {
|
|
107
|
+
if ($form.attr('data-alert-error'))
|
|
108
|
+
Alerts.error($form.attr('data-alert-error'));
|
|
109
|
+
else {
|
|
110
|
+
console.error(response.errors);
|
|
111
|
+
Alerts.error("There are errors on the form, please check your answers and try again.");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
}.bind(this)
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
}
|
package/src/ts/core/Validator.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface ValidatorOptions {
|
|
|
29
29
|
export class Validator {
|
|
30
30
|
element: HTMLFormElement;
|
|
31
31
|
options: ValidatorOptions = {
|
|
32
|
-
errorAlert: 'There are errors, please check
|
|
32
|
+
errorAlert: 'There are errors on the form, please check your answers and try again.',
|
|
33
33
|
useAjax: true
|
|
34
34
|
};
|
|
35
35
|
|
package/src/ts/index.ts
CHANGED
package/temp.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
8^N2a43)Kd|.wdl,
|
package/dist/js/core/BaseSite.js
DELETED
package/src/ts/core/BaseSite.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export class BaseSite {
|
|
2
|
-
|
|
3
|
-
constructor() {
|
|
4
|
-
|
|
5
|
-
// Initialise
|
|
6
|
-
this.initialise();
|
|
7
|
-
|
|
8
|
-
$(window).on('load', this.onLoad.bind(this));
|
|
9
|
-
$(window).on('resize', this.onResize.bind(this));
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
initialise() {
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
onLoad() {
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
onResize() {
|
|
20
|
-
}
|
|
21
|
-
}
|