Stub form controller
This commit is contained in:
26
webgis/js/controllers/form_controller.js
Normal file
26
webgis/js/controllers/form_controller.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Controller } from "@hotwired/stimulus";
|
||||
import { GisState } from "../state.js";
|
||||
import UI from "../ui.js";
|
||||
|
||||
export default class extends Controller {
|
||||
static values = {
|
||||
'coords': String,
|
||||
'group': String,
|
||||
'id': String,
|
||||
};
|
||||
|
||||
static targets = ['search'];
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Event} event
|
||||
*/
|
||||
submitSearch(event) {
|
||||
event.preventDefault();
|
||||
const data = new FormData(event.target);
|
||||
|
||||
for (const entry of data.entries()) {
|
||||
console.log(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import MarkerController from './controllers/marker_controller.js';
|
||||
import BiblioController from './controllers/biblio_controller.js';
|
||||
import TabsController from './controllers/tabs_controller.js';
|
||||
import LayerController from './controllers/layer_controller.js';
|
||||
import FormController from './controllers/form_controller.js';
|
||||
import { GisState } from './state.js';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
// Register Stimulus controllers
|
||||
@@ -26,6 +28,14 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
|
||||
UI.addCenterMapControl(map, GIS.CENTER_COORDS, GIS.INIT_ZOOM);
|
||||
UI.toggleBurger('navbar-burger');
|
||||
|
||||
// TEMP!!
|
||||
const sites = GisState.markers.sites;
|
||||
for (let key of Object.keys(sites)) {
|
||||
if (sites[key].options.data.id === 16) {
|
||||
console.debug('I found it!', key);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function initStimulus() {
|
||||
@@ -36,4 +46,5 @@ function initStimulus() {
|
||||
Stimulus.register("biblio", BiblioController);
|
||||
Stimulus.register("tabs", TabsController);
|
||||
Stimulus.register("layer", LayerController);
|
||||
Stimulus.register("form", FormController);
|
||||
}
|
||||
Reference in New Issue
Block a user