Compact map_marker.js and use Utils.jsonify.

Akinori MUSHA 10 ans auparavant
Parent
Commettre
223f3a61e9
1 fichiers modifiés avec 5 ajouts et 11 suppressions
  1. 5 11
      app/views/shared/_map_marker.html.erb

+ 5 - 11
app/views/shared/_map_marker.html.erb

@@ -1,13 +1,7 @@
1 1
 <%- unless @map_marker_included_p -%>
2
-  <%- content_for :head do -%>
3
-    <%= javascript_include_tag "map_marker" %>
4
-  <%- end -%>
5
-  <%- @map_marker_included_p = true -%>
2
+<%- content_for :head do -%>
3
+<%= javascript_include_tag "map_marker" %>
6 4
 <%- end -%>
7
-  map_marker(<%= map %>, {
8
-    lat: <%= location[:lat].to_json %>,
9
-    lng: <%= location[:lng].to_json %>,
10
-    radius: <%= location[:radius].to_json %>,
11
-    course: <%= location[:course].to_json %>,
12
-    speed: <%= location[:speed].to_json %>
13
-  });
5
+<%- @map_marker_included_p = true -%>
6
+<%- end -%>
7
+map_marker(<%= map %>, <%= Utils.jsonify(location) %>)