2019-09-07 03:42:29 +02:00
|
|
|
/*
|
|
|
|
***************************************************************
|
|
|
|
* *** PAGE SPECIFIC CODDING ***
|
|
|
|
* Place it into app/client/src/js/types
|
|
|
|
* Require page specific css as mentioned bellow
|
|
|
|
*
|
|
|
|
* If you don't need page specific JS (only CSS)
|
|
|
|
* you can create SCSS file at app/client/src/scss/types
|
|
|
|
* !!! BUT NOT BOTH at "types" folder !!!
|
|
|
|
***************************************************************
|
|
|
|
*
|
|
|
|
* An example of Page specific JS and Mapbox functionality
|
|
|
|
* Take a look to app/templates/Objects/Map.ss for HTML
|
|
|
|
* Take a look to https://github.com/a2nt/silverstripe-mapboxfield/blob/master/README.md for Data Structure
|
|
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
// your page specific css
|
2021-08-18 20:51:15 +02:00
|
|
|
import "../scss/_types/PageTypeClassName.scss";
|
2019-09-07 03:42:29 +02:00
|
|
|
|
2021-08-18 20:51:15 +02:00
|
|
|
import $ from "jquery";
|
|
|
|
import Events from "../_events";
|
2019-09-07 03:42:29 +02:00
|
|
|
|
|
|
|
// Mapbox API
|
2021-08-18 20:51:15 +02:00
|
|
|
import "../_components/_ui.map.api";
|
2019-09-07 03:42:29 +02:00
|
|
|
|
|
|
|
const PageTypeUI = (($) => {
|
|
|
|
// Constants
|
|
|
|
const W = window;
|
|
|
|
const D = document;
|
2021-08-18 20:51:15 +02:00
|
|
|
const $Body = $("body");
|
2019-09-07 03:42:29 +02:00
|
|
|
|
2021-08-18 20:51:15 +02:00
|
|
|
const NAME = "PageTypeUI";
|
2019-09-07 03:42:29 +02:00
|
|
|
class PageTypeUI {
|
|
|
|
// Static methods
|
|
|
|
|
|
|
|
static init() {
|
|
|
|
this.dispose();
|
|
|
|
console.log(`Initializing: ${NAME}`);
|
|
|
|
// custom page specific functionality
|
|
|
|
}
|
|
|
|
|
|
|
|
static initMap() {
|
|
|
|
// custom map functionality
|
|
|
|
}
|
|
|
|
|
|
|
|
static dispose() {
|
|
|
|
console.log(`Destroying: ${NAME}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$(W).on(`${Events.AJAX} ${Events.LOADED}`, () => {
|
|
|
|
PageTypeUI.init();
|
|
|
|
});
|
|
|
|
|
|
|
|
$(W).on(Events.MAPLOADED, () => {
|
|
|
|
PageTypeUI.initMap();
|
|
|
|
});
|
|
|
|
|
|
|
|
return PageTypeUI;
|
|
|
|
})($);
|
|
|
|
|
|
|
|
export default PageTypeUI;
|