/new_thread -> /

This commit is contained in:
Swrup 2022-02-22 06:07:29 +01:00
parent bb5fb41c2b
commit b0aaf22ea7
10 changed files with 168 additions and 171 deletions

View file

@ -1,35 +1,3 @@
open Js_map
include Js_post_form
let log = Format.printf
(* set input lat/lng when clicked and make new thread form visible *)
let on_click e =
log "on_click@\n";
let lat_lng = Jv.get e "latlng" in
ignore @@ Jv.call Leaflet.popup "setLatLng" [| lat_lng |];
ignore
@@ Jv.call Leaflet.popup "setContent" [| Jv.of_string "create thread here" |];
ignore @@ Jv.call Leaflet.popup "openOn" [| Leaflet.map |];
let lat = Jv.get lat_lng "lat" in
let lng = Jv.get lat_lng "lng" in
let lat_input = Jv.get Jv.global "lat-input" in
let lng_input = Jv.get Jv.global "lng-input" in
ignore @@ Jv.call lat_input "setAttribute" [| Jv.of_string "value"; lat |];
ignore @@ Jv.call lng_input "setAttribute" [| Jv.of_string "value"; lng |];
let form_div = Jv.get Jv.global "newthread-form" in
ignore
@@ Jv.call form_div "setAttribute"
[| Jv.of_string "style"; Jv.of_string "visibility:visible" |];
let newthread_div = Jv.get Jv.global "newthread" in
ignore
@@ Jv.call newthread_div "setAttribute"
[| Jv.of_string "style"; Jv.of_string "visibility:hidden" |]
(*add on_click callback to map*)
let () =
ignore
@@ Jv.call Leaflet.map "on" [| Jv.of_string "click"; Jv.repr on_click |]