@@ -5,14 +5,15 @@ module GttMapHelper
5
5
def map_form_field ( form , map , field : :geojson , bounds : nil , edit_mode : nil , upload : true , rotation : 0 )
6
6
safe_join [
7
7
form . hidden_field ( field , id : 'geom' ) ,
8
- map_tag ( map : map , bounds : bounds , edit : edit_mode , upload : upload , rotation : rotation )
8
+ map_tag ( map : map , bounds : bounds , edit : edit_mode , upload : upload , rotation : rotation , show : false )
9
9
]
10
10
end
11
11
12
12
def map_tag ( map : nil , layers : map &.layers ,
13
13
geom : map . json , bounds : map . bounds ,
14
14
edit : nil , popup : nil , upload : true ,
15
- collapsed : false , rotation : map &.rotation )
15
+ collapsed : false , rotation : map &.rotation ,
16
+ show : true )
16
17
17
18
data = {
18
19
geom : geom . is_a? ( String ) ? geom : geom . to_json ,
@@ -61,11 +62,13 @@ def map_tag(map: nil, layers: map&.layers,
61
62
};
62
63
observer.observe(document.body, config);
63
64
}
64
- document.addEventListener('contentUpdated', function(){
65
- var target = document.getElementById('#{ uid } ');
66
- window.createGttClient(target);
67
- contentObserver();
68
- }, { once: true });
65
+ if (!#{ show } ) {
66
+ document.addEventListener('contentUpdated', function(){
67
+ var target = document.getElementById('#{ uid } ');
68
+ window.createGttClient(target);
69
+ contentObserver();
70
+ }, { once: true });
71
+ }
69
72
document.addEventListener('DOMContentLoaded', function(){
70
73
var target = document.getElementById('#{ uid } ');
71
74
window.createGttClient(target);
0 commit comments