scrivito_google_maps_widget 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a17fdea7f586d62408848b4b405d3a16d8edac61
|
4
|
+
data.tar.gz: d99b0798a8fe8b954282e5b258d0bd84619d326f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 458137d6fec25a0c88404e5b88f8e13fb5a0cdca1a18e95f2c786bcfb6cb8d0ff11ad5d4a3c7f43a595e98dfa3b999c6daded8cc969d367096d4c1af1843177c
|
7
|
+
data.tar.gz: f1f8b9f2e9a25ddc7d2dfe2716958613c50b36e0175b075e16c11a30b248503fc717908295bb3a34ffa3aee95a29999efb91e8b6ac902e91816b274f258a4570
|
@@ -20,38 +20,41 @@ $ ->
|
|
20
20
|
widgets = $('.google-maps')
|
21
21
|
|
22
22
|
widgets.each ->
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
23
|
+
if google?
|
24
|
+
widget = $(this)
|
25
|
+
canvas = widget.find('.map')
|
26
|
+
|
27
|
+
# Make sure not to initalize a map twice, which can happen if a new
|
28
|
+
# map is added dynamically.
|
29
|
+
if canvas.data('map')
|
30
|
+
return
|
31
|
+
|
32
|
+
mapOptions =
|
33
|
+
center: new google.maps.LatLng(-33.8688, 151.2195)
|
34
|
+
zoom: parseInt(canvas.data('zoom'))
|
35
|
+
scrollwheel: false
|
36
|
+
|
37
|
+
map = new google.maps.Map(canvas[0], mapOptions)
|
38
|
+
canvas.data('map', map)
|
39
|
+
|
40
|
+
infoWindow = new google.maps.InfoWindow()
|
41
|
+
canvas.data('infoWindow', infoWindow)
|
42
|
+
|
43
|
+
marker = new google.maps.Marker
|
44
|
+
map: map
|
45
|
+
anchorPoint: new google.maps.Point(0, -29)
|
46
|
+
canvas.data('marker', marker)
|
47
|
+
|
48
|
+
if content = canvas.attr('data-location')
|
49
|
+
request =
|
50
|
+
query: content
|
51
|
+
|
52
|
+
service = new google.maps.places.PlacesService(map)
|
53
|
+
service.textSearch request, (results, status) ->
|
54
|
+
if status == google.maps.places.PlacesServiceStatus.OK
|
55
|
+
place = results[0] # only interested in the first place found
|
56
|
+
googleMapsWidget.placeMarker(map, infoWindow, marker, place)
|
57
|
+
else
|
58
|
+
widgets.html('Google API is not initialized')
|
59
|
+
|
60
|
+
google?.maps.event.addDomListener(window, 'load', googleMapsWidget.initialize)
|
@@ -3,32 +3,35 @@ $ ->
|
|
3
3
|
widgets = $('.google-maps')
|
4
4
|
|
5
5
|
widgets.each ->
|
6
|
-
|
7
|
-
|
6
|
+
if google?
|
7
|
+
widget = $(this)
|
8
|
+
canvas = widget.find('.map')
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
unless canvas.data('map')
|
11
|
+
googleMapsWidget.initialize()
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
map = canvas.data('map')
|
14
|
+
infoWindow = canvas.data('infoWindow')
|
15
|
+
marker = canvas.data('marker')
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
input = widget.find('input')
|
18
|
+
input.show()
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
content = canvas.attr('data-location')
|
21
|
+
input.attr('value', content)
|
21
22
|
|
22
|
-
|
23
|
+
map.controls[google.maps.ControlPosition.TOP_LEFT] = new Array(input[0])
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
autocomplete = new google.maps.places.Autocomplete(input[0])
|
26
|
+
autocomplete.bindTo('bounds', map)
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
google.maps.event.addListener(autocomplete, 'place_changed', ->
|
29
|
+
place = autocomplete.getPlace()
|
30
|
+
googleMapsWidget.placeMarker(map, infoWindow, marker, place)
|
31
|
+
input.scrivito('save', place.formatted_address)
|
32
|
+
)
|
33
|
+
else
|
34
|
+
widgets.html('Google API is not initialized')
|
32
35
|
|
33
36
|
scrivito.on 'content', ->
|
34
37
|
if scrivito.in_editable_view()
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_google_maps_widget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scrivito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scrivito_sdk
|
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
70
|
rubyforge_project:
|
71
|
-
rubygems_version: 2.
|
71
|
+
rubygems_version: 2.5.1
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
74
|
summary: Scrivito Google Maps Widget.
|