hoodcms 6.0.0 → 6.0.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.
Files changed (39) hide show
  1. package/dist/js/admin/ContentController.d.ts +30 -0
  2. package/dist/js/admin/ContentController.js +188 -0
  3. package/dist/js/admin/ContentTypeController.d.ts +15 -0
  4. package/dist/js/admin/ContentTypeController.js +140 -0
  5. package/dist/js/admin/HomeController.d.ts +17 -0
  6. package/dist/js/admin/HomeController.js +111 -0
  7. package/dist/js/admin/LogsController.d.ts +6 -0
  8. package/dist/js/admin/LogsController.js +14 -0
  9. package/dist/js/admin/MediaController.d.ts +7 -0
  10. package/dist/js/admin/MediaController.js +29 -0
  11. package/dist/js/admin/PropertyController.d.ts +18 -0
  12. package/dist/js/admin/PropertyController.js +118 -0
  13. package/dist/js/admin/PropertyImporter.d.ts +31 -0
  14. package/dist/js/admin/PropertyImporter.js +95 -0
  15. package/dist/js/admin/ThemesController.d.ts +8 -0
  16. package/dist/js/admin/ThemesController.js +37 -0
  17. package/dist/js/admin/UsersController.d.ts +17 -0
  18. package/dist/js/admin/UsersController.js +176 -0
  19. package/dist/js/admin.js +4 -4
  20. package/dist/js/app/PropertyService.d.ts +46 -0
  21. package/{src/ts/app/PropertyController.ts → dist/js/app/PropertyService.js} +44 -76
  22. package/dist/js/app.js +16 -4
  23. package/dist/js/app.property.js +5 -5
  24. package/dist/js/core/DataList.js +25 -3
  25. package/dist/js/index.d.ts +10 -0
  26. package/dist/js/index.js +12 -0
  27. package/dist/js/login.js +1 -1
  28. package/package.json +7 -7
  29. package/src/js/admin.js +491 -469
  30. package/src/js/admin.js.map +1 -1
  31. package/src/js/app.js +11546 -5
  32. package/src/js/app.js.map +1 -1
  33. package/src/js/app.property.js +175 -129
  34. package/src/js/app.property.js.map +1 -1
  35. package/src/js/login.js +1 -1
  36. package/src/ts/app/PropertyService.ts +202 -0
  37. package/src/ts/app.property.ts +4 -5
  38. package/src/ts/core/DataList.ts +27 -4
  39. package/src/ts/index.ts +14 -0
@@ -0,0 +1,46 @@
1
+ /// <reference types="google.maps" />
2
+ import { DataList } from "../core/DataList";
3
+ declare global {
4
+ namespace google.maps {
5
+ interface Marker {
6
+ info: string;
7
+ }
8
+ }
9
+ }
10
+ export interface PropertyServiceOptions {
11
+ listElementId?: string;
12
+ mapListElementId?: string;
13
+ mapElementId?: string;
14
+ /**
15
+ * Called before the data is fetched.
16
+ */
17
+ onListLoad?: (sender?: HTMLElement) => void;
18
+ /**
19
+ * Called before the fetched HTML is rendered to the list. Must return the data back to datalist to render.
20
+ */
21
+ onListRender?: (html: string, sender?: HTMLElement) => string;
22
+ /**
23
+ * Called before the data is fetched.
24
+ */
25
+ onMapLoad?: (data: string, sender?: HTMLElement) => void;
26
+ /**
27
+ * Called before the fetched HTML is rendered to the list. Must return the data back to datalist to render.
28
+ */
29
+ onMapRender?: (sender?: HTMLElement) => string;
30
+ }
31
+ export declare class PropertyService {
32
+ options: PropertyServiceOptions;
33
+ constructor(options?: PropertyServiceOptions);
34
+ element: HTMLElement;
35
+ list: DataList;
36
+ mapListElement: HTMLElement;
37
+ mapList: DataList;
38
+ map: google.maps.Map;
39
+ center: google.maps.LatLngLiteral;
40
+ mapElement: HTMLElement;
41
+ markers: any[];
42
+ initList(): void;
43
+ initMapList(): void;
44
+ initMap(): void;
45
+ reloadMarkers(): void;
46
+ }
@@ -1,125 +1,91 @@
1
1
  /// <reference types="google.maps" />
2
-
3
2
  import { Alerts } from "../core/Alerts";
4
3
  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 class PropertyController {
15
- constructor() {
4
+ export class PropertyService {
5
+ constructor(options) {
6
+ this.options = {
7
+ listElementId: 'property-list',
8
+ mapListElementId: 'property-map-list',
9
+ mapElementId: 'property-map'
10
+ };
11
+ this.map = null;
12
+ this.center = { lat: 30, lng: -110 };
13
+ this.options = Object.assign(Object.assign({}, this.options), options);
16
14
  this.initList();
17
15
  }
18
-
19
- element: HTMLElement;
20
- list: DataList;
21
- mapListElement: HTMLElement;
22
- mapList: DataList;
23
- map: google.maps.Map = null;
24
- center: google.maps.LatLngLiteral = { lat: 30, lng: -110 };
25
- mapElement: HTMLElement;
26
- markers: any[];
27
-
28
16
  initList() {
29
-
30
- this.element = document.getElementById('property-list');
17
+ this.element = document.getElementById(this.options.listElementId);
31
18
  if (!this.element) {
32
19
  return;
33
20
  }
34
-
35
21
  this.list = new DataList(this.element, {
36
- onComplete: function (this: PropertyController, data: string, sender: HTMLElement = null) {
37
-
22
+ onLoad: function (sender = null) {
23
+ if (this.options.onListLoad) {
24
+ this.options.onListLoad(sender);
25
+ }
26
+ }.bind(this),
27
+ onComplete: function (data, sender = null) {
28
+ if (this.options.onListRender) {
29
+ this.options.onListRender(data, sender);
30
+ }
38
31
  Alerts.log('Finished loading property list.', 'info');
39
-
40
32
  }.bind(this)
41
33
  });
42
-
43
34
  }
44
-
45
35
  initMapList() {
46
-
47
- this.mapListElement = document.getElementById('property-map-list');
36
+ this.mapListElement = document.getElementById(this.options.mapListElementId);
48
37
  if (!this.mapElement) {
49
38
  return;
50
39
  }
51
-
52
40
  this.mapList = new DataList(this.mapListElement, {
53
- onComplete: function (this: PropertyController, data: string, sender: HTMLElement = null) {
54
-
41
+ onComplete: function (data, sender = null) {
42
+ if (this.options.onMapLoad) {
43
+ this.options.onMapLoad(data, sender);
44
+ }
55
45
  Alerts.log('Finished loading map list.', 'info');
56
46
  this.reloadMarkers();
57
-
58
47
  }.bind(this)
59
48
  });
60
49
  }
61
-
62
- initMap(mapElementId: string = 'property-map') {
63
-
64
- this.mapElement = document.getElementById(mapElementId);
50
+ initMap() {
51
+ this.mapElement = document.getElementById(this.options.mapElementId);
65
52
  if (!this.mapElement) {
66
53
  return;
67
54
  }
68
-
69
55
  this.center = { lat: +this.mapElement.dataset.lat, lng: +this.mapElement.dataset.long };
70
-
71
56
  this.map = new google.maps.Map(this.mapElement, {
72
57
  zoom: +this.mapElement.dataset.zoom || 15,
73
58
  center: this.center,
74
59
  scrollwheel: false
75
60
  });
76
-
77
- $(window).resize(function (this: PropertyController) {
61
+ $(window).resize(function () {
78
62
  google.maps.event.trigger(this.map, 'resize');
79
63
  }.bind(this));
80
-
81
64
  google.maps.event.trigger(this.map, 'resize');
82
-
83
65
  this.initMapList();
84
-
85
66
  }
86
-
87
67
  reloadMarkers() {
88
-
89
- var infowindow: google.maps.InfoWindow = null;
90
-
68
+ var infowindow = null;
91
69
  if (!this.mapElement) {
92
70
  return;
93
71
  }
94
-
95
72
  var map = this.map;
96
-
97
73
  if (this.markers) {
98
74
  for (var i = 0; i < this.markers.length; i++) {
99
75
  this.markers[i].setMap(null);
100
76
  }
101
77
  }
102
-
103
78
  this.markers = [];
104
-
105
79
  var locations = $("#property-map-locations").data('locations');
106
-
107
- locations.map(function (this: PropertyController, location: any, i: number) {
108
-
80
+ locations.map(function (location, i) {
109
81
  let marker = new google.maps.Marker({
110
82
  position: new google.maps.LatLng(+location.Latitude, +location.Longitude),
111
83
  map: this.map,
112
84
  optimized: true // makes SVG icons work in IE
113
85
  });
114
-
115
-
116
-
117
- //marker.setIcon({
118
- // url: '/images/marker.png',
119
- // size: new google.maps.Size(30, 41),
120
- // scaledSize: new google.maps.Size(30, 41)
121
- //});
122
-
86
+ if (this.mapElement.dataset.marker) {
87
+ marker.setIcon(this.mapElement.dataset.marker);
88
+ }
123
89
  marker.info = `<div class="card border-0" style="max-width:300px">
124
90
  <div style="background-image:url(${location.ImageUrl})" class="rounded img-full img img-wide"></div>
125
91
  <div class="card-body border-0">
@@ -130,21 +96,23 @@ export class PropertyController {
130
96
  <a href="${location.MarkerUrl}" class="btn btn-block btn-primary">Find out more...</a>
131
97
  </div>
132
98
  </div>`;
133
-
134
- google.maps.event.addListener(marker, 'click', function (this: google.maps.Marker) {
135
-
99
+ marker.addListener("click", () => {
136
100
  if (infowindow) {
137
101
  infowindow.close();
138
102
  }
139
103
  infowindow = new google.maps.InfoWindow({
140
- content: this.info
104
+ content: marker.info
105
+ });
106
+ infowindow.open({
107
+ anchor: marker,
108
+ map,
109
+ shouldFocus: false,
141
110
  });
142
- infowindow.open(map, this);
143
-
144
- }.bind(this));
145
-
111
+ });
146
112
  this.markers.push(marker);
147
-
148
113
  }.bind(this));
114
+ if (this.options.onMapRender) {
115
+ this.options.onMapRender();
116
+ }
149
117
  }
150
118
  }