hoodcms 6.0.0 → 6.0.3
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/js/admin/ContentController.d.ts +30 -0
- package/dist/js/admin/ContentController.js +188 -0
- package/dist/js/admin/ContentTypeController.d.ts +15 -0
- package/dist/js/admin/ContentTypeController.js +140 -0
- package/dist/js/admin/HomeController.d.ts +17 -0
- package/dist/js/admin/HomeController.js +111 -0
- package/dist/js/admin/LogsController.d.ts +6 -0
- package/dist/js/admin/LogsController.js +14 -0
- package/dist/js/admin/MediaController.d.ts +7 -0
- package/dist/js/admin/MediaController.js +29 -0
- package/dist/js/admin/PropertyController.d.ts +18 -0
- package/dist/js/admin/PropertyController.js +118 -0
- package/dist/js/admin/PropertyImporter.d.ts +31 -0
- package/dist/js/admin/PropertyImporter.js +95 -0
- package/dist/js/admin/ThemesController.d.ts +8 -0
- package/dist/js/admin/ThemesController.js +37 -0
- package/dist/js/admin/UsersController.d.ts +17 -0
- package/dist/js/admin/UsersController.js +176 -0
- package/dist/js/admin.js +4 -4
- package/dist/js/app/PropertyService.d.ts +46 -0
- package/{src/ts/app/PropertyController.ts → dist/js/app/PropertyService.js} +44 -76
- package/dist/js/app.js +16 -4
- package/dist/js/app.property.js +5 -5
- package/dist/js/core/DataList.js +25 -3
- package/dist/js/index.d.ts +10 -0
- package/dist/js/index.js +12 -0
- package/dist/js/login.js +1 -1
- package/package.json +7 -7
- package/src/js/admin.js +491 -469
- package/src/js/admin.js.map +1 -1
- package/src/js/app.js +11546 -5
- package/src/js/app.js.map +1 -1
- package/src/js/app.property.js +175 -129
- package/src/js/app.property.js.map +1 -1
- package/src/js/login.js +1 -1
- package/src/ts/app/PropertyService.ts +202 -0
- package/src/ts/app.property.ts +4 -5
- package/src/ts/core/DataList.ts +27 -4
- package/src/ts/index.ts +14 -0
- package/temp.txt +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/// <reference types="google.maps" />
|
|
2
|
+
|
|
3
|
+
import { Alerts } from "../core/Alerts";
|
|
4
|
+
import { DataList } from "../core/DataList";
|
|
5
|
+
|
|
6
|
+
declare global {
|
|
7
|
+
namespace google.maps {
|
|
8
|
+
interface Marker {
|
|
9
|
+
info: string;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface PropertyServiceOptions {
|
|
15
|
+
|
|
16
|
+
listElementId?: string;
|
|
17
|
+
mapListElementId?: string;
|
|
18
|
+
mapElementId?: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Called before the data is fetched.
|
|
22
|
+
*/
|
|
23
|
+
onListLoad?: (sender?: HTMLElement) => void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Called before the fetched HTML is rendered to the list. Must return the data back to datalist to render.
|
|
27
|
+
*/
|
|
28
|
+
onListRender?: (html: string, sender?: HTMLElement) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Called before the data is fetched.
|
|
31
|
+
*/
|
|
32
|
+
onMapLoad?: (data: string, sender?: HTMLElement) => void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Called before the fetched HTML is rendered to the list. Must return the data back to datalist to render.
|
|
36
|
+
*/
|
|
37
|
+
onMapRender?: (sender?: HTMLElement) => string;
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export class PropertyService {
|
|
42
|
+
options: PropertyServiceOptions = {
|
|
43
|
+
listElementId: 'property-list',
|
|
44
|
+
mapListElementId: 'property-map-list',
|
|
45
|
+
mapElementId: 'property-map'
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
constructor(options?: PropertyServiceOptions) {
|
|
49
|
+
|
|
50
|
+
this.options = { ...this.options, ...options };
|
|
51
|
+
|
|
52
|
+
this.initList();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
element: HTMLElement;
|
|
56
|
+
list: DataList;
|
|
57
|
+
mapListElement: HTMLElement;
|
|
58
|
+
mapList: DataList;
|
|
59
|
+
map: google.maps.Map = null;
|
|
60
|
+
center: google.maps.LatLngLiteral = { lat: 30, lng: -110 };
|
|
61
|
+
mapElement: HTMLElement;
|
|
62
|
+
markers: any[];
|
|
63
|
+
|
|
64
|
+
initList() {
|
|
65
|
+
|
|
66
|
+
this.element = document.getElementById(this.options.listElementId);
|
|
67
|
+
if (!this.element) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.list = new DataList(this.element, {
|
|
72
|
+
onLoad: function (this: PropertyService, sender: HTMLElement = null) {
|
|
73
|
+
|
|
74
|
+
if (this.options.onListLoad) {
|
|
75
|
+
this.options.onListLoad(sender);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
}.bind(this),
|
|
79
|
+
onComplete: function (this: PropertyService, data: string, sender: HTMLElement = null) {
|
|
80
|
+
|
|
81
|
+
if (this.options.onListRender) {
|
|
82
|
+
this.options.onListRender(data, sender);
|
|
83
|
+
}
|
|
84
|
+
Alerts.log('Finished loading property list.', 'info');
|
|
85
|
+
|
|
86
|
+
}.bind(this)
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
initMapList() {
|
|
92
|
+
|
|
93
|
+
this.mapListElement = document.getElementById(this.options.mapListElementId);
|
|
94
|
+
if (!this.mapElement) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
this.mapList = new DataList(this.mapListElement, {
|
|
99
|
+
onComplete: function (this: PropertyService, data: string, sender: HTMLElement = null) {
|
|
100
|
+
|
|
101
|
+
if (this.options.onMapLoad) {
|
|
102
|
+
this.options.onMapLoad(data, sender);
|
|
103
|
+
}
|
|
104
|
+
Alerts.log('Finished loading map list.', 'info');
|
|
105
|
+
this.reloadMarkers();
|
|
106
|
+
|
|
107
|
+
}.bind(this)
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
initMap() {
|
|
112
|
+
|
|
113
|
+
this.mapElement = document.getElementById(this.options.mapElementId);
|
|
114
|
+
if (!this.mapElement) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
this.center = { lat: +this.mapElement.dataset.lat, lng: +this.mapElement.dataset.long };
|
|
119
|
+
|
|
120
|
+
this.map = new google.maps.Map(this.mapElement, {
|
|
121
|
+
zoom: +this.mapElement.dataset.zoom || 15,
|
|
122
|
+
center: this.center,
|
|
123
|
+
scrollwheel: false
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
$(window).resize(function (this: PropertyService) {
|
|
127
|
+
google.maps.event.trigger(this.map, 'resize');
|
|
128
|
+
}.bind(this));
|
|
129
|
+
|
|
130
|
+
google.maps.event.trigger(this.map, 'resize');
|
|
131
|
+
|
|
132
|
+
this.initMapList();
|
|
133
|
+
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
reloadMarkers() {
|
|
137
|
+
|
|
138
|
+
var infowindow: google.maps.InfoWindow = null;
|
|
139
|
+
|
|
140
|
+
if (!this.mapElement) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
var map = this.map;
|
|
145
|
+
|
|
146
|
+
if (this.markers) {
|
|
147
|
+
for (var i = 0; i < this.markers.length; i++) {
|
|
148
|
+
this.markers[i].setMap(null);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
this.markers = [];
|
|
153
|
+
|
|
154
|
+
var locations = $("#property-map-locations").data('locations');
|
|
155
|
+
|
|
156
|
+
locations.map(function (this: PropertyService, location: any, i: number) {
|
|
157
|
+
|
|
158
|
+
let marker = new google.maps.Marker({
|
|
159
|
+
position: new google.maps.LatLng(+location.Latitude, +location.Longitude),
|
|
160
|
+
map: this.map,
|
|
161
|
+
optimized: true // makes SVG icons work in IE
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if (this.mapElement.dataset.marker) {
|
|
165
|
+
marker.setIcon(this.mapElement.dataset.marker);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
marker.info = `<div class="card border-0" style="max-width:300px">
|
|
169
|
+
<div style="background-image:url(${location.ImageUrl})" class="rounded img-full img img-wide"></div>
|
|
170
|
+
<div class="card-body border-0">
|
|
171
|
+
<p style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
|
|
172
|
+
<strong>${location.Address1}, ${location.Postcode}</strong>
|
|
173
|
+
</p>
|
|
174
|
+
<p>${location.Description}</p>
|
|
175
|
+
<a href="${location.MarkerUrl}" class="btn btn-block btn-primary">Find out more...</a>
|
|
176
|
+
</div>
|
|
177
|
+
</div>`;
|
|
178
|
+
|
|
179
|
+
marker.addListener("click", () => {
|
|
180
|
+
if (infowindow) {
|
|
181
|
+
infowindow.close();
|
|
182
|
+
}
|
|
183
|
+
infowindow = new google.maps.InfoWindow({
|
|
184
|
+
content: marker.info
|
|
185
|
+
});
|
|
186
|
+
infowindow.open({
|
|
187
|
+
anchor: marker,
|
|
188
|
+
map,
|
|
189
|
+
shouldFocus: false,
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
this.markers.push(marker);
|
|
194
|
+
|
|
195
|
+
}.bind(this));
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
if (this.options.onMapRender) {
|
|
199
|
+
this.options.onMapRender();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
package/src/ts/app.property.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/// <reference types="google.maps" />
|
|
2
2
|
|
|
3
|
-
import { HoodApi } from "
|
|
4
|
-
import { PropertyController } from './app/PropertyController';
|
|
3
|
+
import { HoodApi, PropertyService } from ".";
|
|
5
4
|
|
|
6
5
|
export class App extends HoodApi {
|
|
7
|
-
property:
|
|
8
|
-
|
|
6
|
+
property: PropertyService;
|
|
7
|
+
|
|
9
8
|
constructor() {
|
|
10
9
|
super();
|
|
11
10
|
|
|
@@ -13,7 +12,7 @@ export class App extends HoodApi {
|
|
|
13
12
|
this.initialise();
|
|
14
13
|
|
|
15
14
|
// Initialise the property controllers.
|
|
16
|
-
this.property = new
|
|
15
|
+
this.property = new PropertyService();
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
}
|
package/src/ts/core/DataList.ts
CHANGED
|
@@ -46,7 +46,7 @@ export class DataList {
|
|
|
46
46
|
|
|
47
47
|
this.element = element;
|
|
48
48
|
this.element.hoodDataList = this;
|
|
49
|
-
if (typeof(element) == 'undefined' || element == null) {
|
|
49
|
+
if (typeof (element) == 'undefined' || element == null) {
|
|
50
50
|
Alerts.log('Could not DataList to element, element does not exist.', 'error');
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
@@ -54,9 +54,32 @@ export class DataList {
|
|
|
54
54
|
this.options = { ...this.options, ...options };
|
|
55
55
|
|
|
56
56
|
if ($(this.element).hasClass('query')) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
|
|
58
|
+
let r = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
59
|
+
let pageUrl: URL = null;
|
|
60
|
+
if (r.test(this.element.dataset.url)) {
|
|
61
|
+
pageUrl = new URL(this.element.dataset.url);
|
|
62
|
+
} else {
|
|
63
|
+
pageUrl = new URL(window.location.origin + this.element.dataset.url);
|
|
64
|
+
}
|
|
65
|
+
if ('URLSearchParams' in window) {
|
|
66
|
+
var searchParams = new URLSearchParams(window.location.search);
|
|
67
|
+
var urlParams = new URLSearchParams(pageUrl.search);
|
|
68
|
+
searchParams.forEach((value, key, parent) => {
|
|
69
|
+
urlParams.set(key, value);
|
|
70
|
+
});
|
|
71
|
+
if (urlParams.get("page") == "0") {
|
|
72
|
+
urlParams.set("page", "1");
|
|
73
|
+
}
|
|
74
|
+
pageUrl.search = urlParams.toString();
|
|
75
|
+
} else {
|
|
76
|
+
pageUrl.search = window.location.search;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let url = pageUrl.pathname + pageUrl.search;
|
|
80
|
+
$(this.element).attr('data-url', url);
|
|
81
|
+
$(this.element).data('url', url);
|
|
82
|
+
|
|
60
83
|
}
|
|
61
84
|
|
|
62
85
|
if (!$(this.element).hasClass('refresh-only')) {
|
package/src/ts/index.ts
CHANGED
|
@@ -23,3 +23,17 @@ export * from './core/Validator'
|
|
|
23
23
|
export * from './extensions/jqueryExtensions'
|
|
24
24
|
export * from './extensions/numberExtensions'
|
|
25
25
|
export * from './extensions/stringExtensions'
|
|
26
|
+
|
|
27
|
+
// Extendables for admin area
|
|
28
|
+
export * from './admin/ContentController'
|
|
29
|
+
export * from './admin/ContentTypeController'
|
|
30
|
+
export * from './admin/HomeController'
|
|
31
|
+
export * from './admin/LogsController'
|
|
32
|
+
export * from './admin/MediaController'
|
|
33
|
+
export * from './admin/PropertyController'
|
|
34
|
+
export * from './admin/PropertyImporter'
|
|
35
|
+
export * from './admin/ThemesController'
|
|
36
|
+
export * from './admin/UsersController'
|
|
37
|
+
|
|
38
|
+
// Extendables for app
|
|
39
|
+
export * from './app/PropertyService'
|
package/temp.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8^N2a43)Kd|.wdl,
|