File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 35
35
end
36
36
end
37
37
end
38
+
39
+ module Decidim
40
+ module Map
41
+ class DynamicMap < Map ::Frontend
42
+ class Builder < Decidim ::Map ::Frontend ::Builder
43
+ # Overwrite
44
+ def map_element ( html_options = { } )
45
+ opts = view_options
46
+ opts [ "markers" ] = opts [ "markers" ] . reject { |item | item [ :latitude ] . nil? || item [ :latitude ] . nan? } if opts [ "markers" ] . present?
47
+ map_html_options = {
48
+ "data-decidim-map" => opts . to_json ,
49
+ # The data-markers-data is kept for backwards compatibility
50
+ "data-markers-data" => opts . fetch ( :markers , [ ] ) . to_json
51
+ } . merge ( html_options )
52
+
53
+ content = template . capture { yield } . html_safe if block_given?
54
+
55
+ template . content_tag ( :div , map_html_options ) do
56
+ ( content || "" )
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
38
63
end
You can’t perform that action at this time.
0 commit comments