gmap_coordinates_picker 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbf53dc24174b7e8347798db04664dbe04312b4f
4
- data.tar.gz: 0742d3f4c13aad9ea3679dbf961ff40932147cb9
3
+ metadata.gz: a417df0a88184eb16669c710d32668f45a811984
4
+ data.tar.gz: ed47eb46faa349b468751ce71a47deba88915931
5
5
  SHA512:
6
- metadata.gz: 0f3803fa9264328ffe8ac90fa8e169b28c78d6d5cde5f40837405b6e7eca023b3fb481b739fae1537f3f2ef91d07146f4b94f8131fe4a82a0604ce1e38fe6e9a
7
- data.tar.gz: a1d1a3317f016994cc5b16f990b3412340cee163f6f63d166ac16ea3bb375d8b7dbf99e5836b9c68216f88deb9ad5092723ef6ab2fadb0531d63faaccbc6874e
6
+ metadata.gz: 2c5d664092d1187f3cdf3ad1dec7f2ffafeccf91e4084cd6adcefdd710edec6bf336a5f889dbd3440ec97fa0ec3af36d9cd0fba042e01433be17d46e19478b8c
7
+ data.tar.gz: 07134e1e06953694aca14e58f8417b8523777fff430c530c4898cc17808b90371fc222a4c62c25e0677f0b014b950ba1d6b92ce92e45d0832b66ef88903afa18
@@ -1,23 +1,14 @@
1
- <%= javascript_include_tag ("https://maps.googleapis.com/maps/api/js?key=#{api_key}&sensor=false") %>
1
+
2
2
  <script type="text/javascript">
3
- var <%= map_handler%> = <%= map_handler%> || {};
4
- var <%= map_handler%>Marker = <%= map_handler%>Marker || {};
3
+ var afterGmapLoaded = function(){
4
+ var <%= map_handler%> = <%= map_handler%> || {};
5
5
 
6
- jQuery(function () {
7
6
  var marker = null;
8
- var defaultPoint = null;
9
- var center = null;
10
-
11
- <% if lat_column_value && lng_column_value%>
12
- defaultPoint = new google.maps.LatLng(<%= lat_column_value%>, <%=lng_column_value %>);
13
- <% end %>
14
- <% unless default_coordinates.empty?%>
15
- center = new google.maps.LatLng(<%= default_coordinates[0]%>, <%=default_coordinates[1] %>);
16
- <% end %>
7
+ var latlng = new google.maps.LatLng(<%= default_coordinates[0]%>, <%=default_coordinates[1] %>);
17
8
 
18
9
  var myOptions = {
19
10
  zoom: <%=zoom_level %>,
20
- center: center,
11
+ center:latlng,
21
12
  mapTypeId:google.maps.MapTypeId.ROADMAP
22
13
  };
23
14
 
@@ -26,12 +17,10 @@
26
17
 
27
18
  <% if lat_column_value && lng_column_value%>
28
19
  marker = new google.maps.Marker({
29
- position:defaultPoint,
20
+ position:new google.maps.LatLng(<%= lat_column_value%>,<%=lng_column_value %>),
30
21
  map:map
31
22
  });
32
- <% end%>
33
-
34
- <%= map_handler%>Marker = marker;
23
+ <% end%>
35
24
 
36
25
  google.maps.event.addListener(map, 'click', function(e) {
37
26
  updateLocation(e.latLng);
@@ -46,13 +35,22 @@
46
35
  map: map
47
36
  });
48
37
  }
49
- <%= map_handler%>Marker = marker;
38
+
50
39
  map.setCenter(location);
51
40
  jQuery("#<%= lat_dom_id%>").val(location.lat());
52
41
  jQuery("#<%=lng_dom_id %>").val(location.lng());
53
42
  }
54
43
 
55
- });
44
+
45
+ }
46
+ if (typeof window.google == 'undefined' || typeof google.maps == 'undefined'){
47
+ $.getScript('<%= "http://maps.googleapis.com/maps/api/js?key=#{api_key}" %>', function(){
48
+ afterGmapLoaded()
49
+ });
50
+ }else {
51
+ afterGmapLoaded();
52
+ }
53
+
56
54
  </script>
57
55
  <div class="<%= map_container_class%>" id="<%=map_container%>" style="<%= "width:#{map_width};height:#{map_height}"%>">
58
56
  </div>
@@ -1,3 +1,3 @@
1
1
  module GmapCoordinatesPicker
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,19 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gmap_coordinates_picker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muntasim Ahmed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-25 00:00:00.000000000 Z
11
+ date: 2017-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.1'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
22
  version: 3.1.0
@@ -21,6 +24,9 @@ dependencies:
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '5.1'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
32
  version: 3.1.0