gmaps4rails 1.5.0.pre → 1.5.0.pre2
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.
- data/Gemfile +3 -1
- data/Gemfile.lock +1 -1
- data/Guardfile +2 -16
- data/README.rdoc +15 -0
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.base.js.coffee +10 -8
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.bing.js.coffee +4 -4
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.googlemaps.js.coffee +8 -8
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.mapquest.js.coffee +5 -5
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.openlayers.js.coffee +9 -9
- data/gmaps4rails.gemspec +1 -2
- data/lib/gmaps4rails.rb +4 -0
- data/lib/gmaps4rails/json_builder.rb +1 -1
- data/lib/gmaps4rails/version.rb +1 -1
- data/lib/gmaps4rails/view_helper.rb +3 -1
- data/public/javascripts/gmaps4rails/gmaps4rails.base.js +9 -7
- data/public/javascripts/gmaps4rails/gmaps4rails.bing.js +4 -4
- data/public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js +8 -8
- data/public/javascripts/gmaps4rails/gmaps4rails.mapquest.js +7 -5
- data/public/javascripts/gmaps4rails/gmaps4rails.openlayers.js +10 -10
- data/spec/dummy/app/assets/stylesheets/application.css +2 -0
- data/spec/dummy/app/controllers/users_controller.rb +5 -0
- data/spec/dummy/app/models/user.rb +1 -4
- data/spec/dummy/app/views/users/index.html.erb +84 -85
- data/spec/dummy/public/logo.png +0 -0
- data/spec/javascripts/basic_methods_spec.js +1 -1
- data/spec/javascripts/markers_methods_spec.js +3 -3
- data/spec/javascripts/support/jasmine.yml +1 -67
- data/spec/models/user_spec.rb +22 -2
- data/spec/spec_helper.rb +0 -1
- metadata +7 -42
- data/spec/dummy/app/views/users/_my_template.html.erb +0 -2
- data/spec/dummy/app/views/users/_my_template2.html.erb +0 -1
- data/spec/dummy/app/views/users/ajax_data.js.erb +0 -2
- data/spec/dummy/app/views/users/ajax_test.html.erb +0 -22
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/Guardfile
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
|
4
1
|
guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' } do
|
5
2
|
watch('config/application.rb')
|
6
3
|
watch('config/environment.rb')
|
@@ -10,12 +7,11 @@ guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' } do
|
|
10
7
|
watch('Gemfile.lock')
|
11
8
|
watch('spec/spec_helper.rb') { :rspec }
|
12
9
|
end
|
13
|
-
|
14
10
|
|
15
11
|
guard 'rspec', :cli => "-c -f d", :all_on_start => false, :all_after_pass => false do
|
16
12
|
watch(%r{^spec/.+_spec\.rb$})
|
17
13
|
watch('spec/launchers/all_specs.rb') { "spec" }
|
18
|
-
watch('spec/launchers/all_but_requests.rb') { ["spec/base", "spec/helpers", "spec/models", "spec/views"] }
|
14
|
+
watch('spec/launchers/all_but_requests.rb') { ["spec/base", "spec/helpers", "spec/models", "spec/views", "spec/javascripts"] }
|
19
15
|
watch('spec/launchers/requests.rb') { "spec/requests" }
|
20
16
|
end
|
21
17
|
|
@@ -25,14 +21,4 @@ guard 'jasmine', :jasmine_url => 'http://localhost:8888/', :all_on_start => fals
|
|
25
21
|
watch(%r{^spec/javascripts/.+_spec\.js$}) { "spec/javascripts" }
|
26
22
|
end
|
27
23
|
|
28
|
-
|
29
|
-
#--drb
|
30
|
-
|
31
|
-
guard 'coffeescript', :input => 'app/assets/javascripts/gmaps4rails', :output => 'public/javascripts/gmaps4rails'
|
32
|
-
|
33
|
-
#
|
34
|
-
#guard 'coffeescript', :input => 'spec/javascripts/coffee', :output => 'spec/javascripts'
|
35
|
-
|
36
|
-
# do
|
37
|
-
# watch(/^app\/assets\/javascripts\/gmaps4rails\/(.*).coffee/)
|
38
|
-
# end
|
24
|
+
guard 'coffeescript', :input => 'app/assets/javascripts/gmaps4rails', :output => 'public/javascripts/gmaps4rails'
|
data/README.rdoc
CHANGED
@@ -104,6 +104,21 @@ Done!
|
|
104
104
|
|
105
105
|
Feel free to contact us, you have your say.
|
106
106
|
|
107
|
+
== Want to help?
|
108
|
+
|
109
|
+
This is how you can launch the spec suite (js + ruby):
|
110
|
+
|
111
|
+
* Clone the gem repository
|
112
|
+
|
113
|
+
* Go to the gem's folder
|
114
|
+
|
115
|
+
* run `bundle`
|
116
|
+
|
117
|
+
* run `cd spec/dummy; rake db:migrate RAILS_ENV=test; cd ../..`
|
118
|
+
|
119
|
+
* run `bundle exec rspec spec`
|
120
|
+
|
121
|
+
|
107
122
|
== Copyright
|
108
123
|
MIT license.
|
109
124
|
|
@@ -18,7 +18,8 @@ class @Gmaps4Rails
|
|
18
18
|
|
19
19
|
constructor: ->
|
20
20
|
#map config
|
21
|
-
@map = null #
|
21
|
+
@map = null #DEPRECATED: will still contain a copy of serviceObject below as transition
|
22
|
+
@serviceObject = null #contains the map we're working on
|
22
23
|
@visibleInfoWindow = null #contains the current opened infowindow
|
23
24
|
@userLocation = null #contains user's location if geolocalization was performed and successful
|
24
25
|
|
@@ -71,7 +72,8 @@ class @Gmaps4Rails
|
|
71
72
|
|
72
73
|
#tnitializes the map
|
73
74
|
initialize : ->
|
74
|
-
@
|
75
|
+
@serviceObject = @createMap()
|
76
|
+
@map = @serviceObject #beware, soon deprecated
|
75
77
|
if (@map_options.detect_location == true or @map_options.center_on_user == true)
|
76
78
|
@findUserLocation(this)
|
77
79
|
#resets sidebar if needed
|
@@ -102,7 +104,7 @@ class @Gmaps4Rails
|
|
102
104
|
directionsDisplay = new google.maps.DirectionsRenderer()
|
103
105
|
directionsService = new google.maps.DirectionsService()
|
104
106
|
|
105
|
-
directionsDisplay.setMap(@
|
107
|
+
directionsDisplay.setMap(@serviceObject)
|
106
108
|
#display panel only if required
|
107
109
|
if @direction_conf.display_panel
|
108
110
|
directionsDisplay.setPanel(document.getElementById(@direction_conf.panel_id))
|
@@ -162,7 +164,7 @@ class @Gmaps4Rails
|
|
162
164
|
radius: circle.radius
|
163
165
|
|
164
166
|
circle.serviceObject = newCircle
|
165
|
-
newCircle.setMap(@
|
167
|
+
newCircle.setMap(@serviceObject)
|
166
168
|
|
167
169
|
# clear circles
|
168
170
|
clear_circles : ->
|
@@ -184,7 +186,7 @@ class @Gmaps4Rails
|
|
184
186
|
@show_circle @circle
|
185
187
|
|
186
188
|
show_circle : (circle) ->
|
187
|
-
circle.serviceObject.setMap(@
|
189
|
+
circle.serviceObject.setMap(@serviceObject)
|
188
190
|
|
189
191
|
#////////////////////////////////////////////////////
|
190
192
|
#///////////////////// POLYGONS /////////////////////
|
@@ -221,7 +223,7 @@ class @Gmaps4Rails
|
|
221
223
|
fillColor: fillColor
|
222
224
|
fillOpacity: fillOpacity
|
223
225
|
clickable: clickable
|
224
|
-
map: @
|
226
|
+
map: @serviceObject
|
225
227
|
|
226
228
|
#save polygon in list
|
227
229
|
polygon.serviceObject = new_poly
|
@@ -292,7 +294,7 @@ class @Gmaps4Rails
|
|
292
294
|
|
293
295
|
#save polyline
|
294
296
|
polyline.serviceObject = new_poly
|
295
|
-
new_poly.setMap(@
|
297
|
+
new_poly.setMap(@serviceObject)
|
296
298
|
|
297
299
|
#////////////////////////////////////////////////////
|
298
300
|
#///////////////////// MARKERS //////////////////////
|
@@ -450,7 +452,7 @@ class @Gmaps4Rails
|
|
450
452
|
map_center = @boundsObject.getCenter()
|
451
453
|
@map_options.center_latitude = map_center.lat()
|
452
454
|
@map_options.center_longitude = map_center.lng()
|
453
|
-
@
|
455
|
+
@serviceObject.setCenter(map_center)
|
454
456
|
else
|
455
457
|
@fitBounds()
|
456
458
|
|
@@ -151,13 +151,13 @@ class @Gmaps4RailsBing extends Gmaps4Rails
|
|
151
151
|
#////////////////////////////////////////////////////
|
152
152
|
|
153
153
|
fitBounds: ->
|
154
|
-
@
|
154
|
+
@serviceObject.setView({bounds: @boundsObject})
|
155
155
|
|
156
156
|
addToMap: (object)->
|
157
|
-
@
|
157
|
+
@serviceObject.entities.push(object)
|
158
158
|
|
159
159
|
removeFromMap: (object)->
|
160
|
-
@
|
160
|
+
@serviceObject.entities.remove(object)
|
161
161
|
|
162
162
|
centerMapOnUser: ->
|
163
|
-
@
|
163
|
+
@serviceObject.setView({ center: @userLocation})
|
@@ -112,14 +112,14 @@ class @Gmaps4RailsGoogle extends Gmaps4Rails
|
|
112
112
|
markerLatLng = @createLatLng(args.Lat, args.Lng)
|
113
113
|
#Marker sizes are expressed as a Size of X,Y
|
114
114
|
if args.marker_picture == "" and args.rich_marker == null
|
115
|
-
defaultOptions = {position: markerLatLng, map: @
|
115
|
+
defaultOptions = {position: markerLatLng, map: @serviceObject, title: args.marker_title, draggable: args.marker_draggable, zIndex: args.zindex}
|
116
116
|
mergedOptions = @mergeObjectWithDefault @markers_conf.raw, defaultOptions
|
117
117
|
return new google.maps.Marker mergedOptions
|
118
118
|
|
119
119
|
if (args.rich_marker != null)
|
120
120
|
return new RichMarker({
|
121
121
|
position: markerLatLng
|
122
|
-
map: @
|
122
|
+
map: @serviceObject
|
123
123
|
draggable: args.marker_draggable
|
124
124
|
content: args.rich_marker
|
125
125
|
flat: if args.marker_anchor == null then false else args.marker_anchor[1]
|
@@ -134,7 +134,7 @@ class @Gmaps4RailsGoogle extends Gmaps4Rails
|
|
134
134
|
#create or retrieve existing MarkerImages
|
135
135
|
markerImage = @createOrRetrieveImage(args.marker_picture, args.marker_width, args.marker_height, imageAnchorPosition)
|
136
136
|
shadowImage = @createOrRetrieveImage(args.shadow_picture, args.shadow_width, args.shadow_height, shadowAnchorPosition)
|
137
|
-
defaultOptions = {position: markerLatLng, map: @
|
137
|
+
defaultOptions = {position: markerLatLng, map: @serviceObject, icon: markerImage, title: args.marker_title, draggable: args.marker_draggable, shadow: shadowImage, zIndex: args.zindex}
|
138
138
|
mergedOptions = @mergeObjectWithDefault @markers_conf.raw, defaultOptions
|
139
139
|
return new google.maps.Marker mergedOptions
|
140
140
|
|
@@ -192,7 +192,7 @@ class @Gmaps4RailsGoogle extends Gmaps4Rails
|
|
192
192
|
#////////////////////////////////////////////////////
|
193
193
|
|
194
194
|
createClusterer : (markers_array) ->
|
195
|
-
return new MarkerClusterer( @
|
195
|
+
return new MarkerClusterer( @serviceObject, markers_array, { maxZoom: @markers_conf.clusterer_maxZoom, gridSize: @markers_conf.clusterer_gridSize, styles: @customClusterer() })
|
196
196
|
|
197
197
|
clearClusterer : ->
|
198
198
|
@markerClusterer.clearMarkers()
|
@@ -236,7 +236,7 @@ class @Gmaps4RailsGoogle extends Gmaps4Rails
|
|
236
236
|
return ->
|
237
237
|
# Close the latest selected marker before opening the current one.
|
238
238
|
currentMap.visibleInfoWindow.close() if currentMap.visibleInfoWindow != null
|
239
|
-
infoWindow.open(currentMap.
|
239
|
+
infoWindow.open(currentMap.serviceObject, marker)
|
240
240
|
currentMap.visibleInfoWindow = infoWindow
|
241
241
|
|
242
242
|
#////////////////////////////////////////////////////
|
@@ -247,7 +247,7 @@ class @Gmaps4RailsGoogle extends Gmaps4Rails
|
|
247
247
|
kml_options = kml.options || {}
|
248
248
|
kml_options = @mergeObjectWithDefault(kml_options, @kml_options)
|
249
249
|
kml = new google.maps.KmlLayer( kml.url, kml_options)
|
250
|
-
kml.setMap(@
|
250
|
+
kml.setMap(@serviceObject)
|
251
251
|
return kml
|
252
252
|
|
253
253
|
|
@@ -256,8 +256,8 @@ class @Gmaps4RailsGoogle extends Gmaps4Rails
|
|
256
256
|
#////////////////////////////////////////////////////
|
257
257
|
|
258
258
|
fitBounds : ->
|
259
|
-
@
|
259
|
+
@serviceObject.fitBounds(@boundsObject) unless @boundsObject.isEmpty()
|
260
260
|
|
261
261
|
centerMapOnUser : ->
|
262
|
-
@
|
262
|
+
@serviceObject.setCenter(@userLocation)
|
263
263
|
|
@@ -121,14 +121,14 @@ class @Gmaps4RailsMapquest extends Gmaps4Rails
|
|
121
121
|
#////////////////////////////////////////////////////
|
122
122
|
|
123
123
|
fitBounds: ->
|
124
|
-
@
|
125
|
-
@
|
124
|
+
@serviceObject.zoomToRect @boundsObject if @markers.length >=2
|
125
|
+
@serviceObject.setCenter @markers[0].serviceObject.latLng if @markers.length == 1
|
126
126
|
|
127
127
|
centerMapOnUser: ->
|
128
|
-
@
|
128
|
+
@serviceObject.setCenter @userLocation
|
129
129
|
|
130
130
|
addToMap: (object) ->
|
131
|
-
@
|
131
|
+
@serviceObject.addShape object
|
132
132
|
|
133
133
|
removeFromMap: (object)->
|
134
|
-
@
|
134
|
+
@serviceObject.removeShape object
|
@@ -57,12 +57,12 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
|
|
57
57
|
#//creating markers' dedicated layer
|
58
58
|
if (@markersLayer == null)
|
59
59
|
@markersLayer = new OpenLayers.Layer.Vector("Markers", null)
|
60
|
-
@
|
60
|
+
@serviceObject.addLayer(@markersLayer)
|
61
61
|
#//TODO move?
|
62
62
|
@markersLayer.events.register("featureselected", @markersLayer, @onFeatureSelect)
|
63
63
|
@markersLayer.events.register("featureunselected", @markersLayer, @onFeatureUnselect)
|
64
64
|
@markersControl = new OpenLayers.Control.SelectFeature(@markersLayer)
|
65
|
-
@
|
65
|
+
@serviceObject.addControl(@markersControl)
|
66
66
|
@markersControl.activate()
|
67
67
|
#//showing default pic if none available
|
68
68
|
if args.marker_picture == ""
|
@@ -107,7 +107,7 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
|
|
107
107
|
@boundsObject = new OpenLayers.Bounds()
|
108
108
|
|
109
109
|
clearMarkersLayerIfExists: ->
|
110
|
-
@
|
110
|
+
@serviceObject.removeLayer(@markersLayer) if @markersLayer != null and @serviceObject.getLayer(@markersLayer.id) != null
|
111
111
|
|
112
112
|
extendBoundsWithMarkers: ->
|
113
113
|
for marker in @markers
|
@@ -148,7 +148,7 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
|
|
148
148
|
strokeColor: "#32a8a9"
|
149
149
|
|
150
150
|
@clearMarkersLayerIfExists()
|
151
|
-
@
|
151
|
+
@serviceObject.addLayer(clusters)
|
152
152
|
clusters.addFeatures(markers_array)
|
153
153
|
return clusters
|
154
154
|
|
@@ -164,7 +164,7 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
|
|
164
164
|
@markerClusterer = @createClusterer markers_array
|
165
165
|
|
166
166
|
clearClusterer: ->
|
167
|
-
@
|
167
|
+
@serviceObject.removeLayer @markerClusterer
|
168
168
|
|
169
169
|
#////////////////////////////////////////////////////
|
170
170
|
#/////////////////// INFO WINDOW ////////////////////
|
@@ -187,13 +187,13 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
|
|
187
187
|
null, true, @onPopupClose)
|
188
188
|
feature.popup = popup
|
189
189
|
popup.feature = feature
|
190
|
-
@
|
190
|
+
@serviceObject.addPopup popup
|
191
191
|
|
192
192
|
onFeatureUnselect: (evt) ->
|
193
193
|
feature = evt.feature
|
194
194
|
if feature.popup
|
195
195
|
#//popup.feature = null;
|
196
|
-
@
|
196
|
+
@serviceObject.removePopup feature.popup
|
197
197
|
feature.popup.destroy()
|
198
198
|
feature.popup = null
|
199
199
|
|
@@ -202,8 +202,8 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
|
|
202
202
|
# #////////////////////////////////////////////////////
|
203
203
|
|
204
204
|
fitBounds: ->
|
205
|
-
@
|
205
|
+
@serviceObject.zoomToExtent(@boundsObject, true)
|
206
206
|
|
207
207
|
centerMapOnUser: ->
|
208
|
-
@
|
208
|
+
@serviceObject.setCenter @userLocation
|
209
209
|
|
data/gmaps4rails.gemspec
CHANGED
@@ -17,14 +17,13 @@ Gem::Specification.new do |s|
|
|
17
17
|
|
18
18
|
s.add_development_dependency "rails", "~> 3.2.1"
|
19
19
|
s.add_development_dependency "sqlite3"
|
20
|
-
s.add_development_dependency "jquery-rails"
|
21
20
|
|
22
21
|
s.add_development_dependency "rspec-rails"
|
23
22
|
s.add_development_dependency 'database_cleaner'
|
24
23
|
#s.add_development_dependency "capybara"
|
25
24
|
#s.add_development_dependency 'launchy'
|
26
25
|
|
27
|
-
s.add_development_dependency "jasmine"
|
26
|
+
#s.add_development_dependency "jasmine"
|
28
27
|
|
29
28
|
s.add_development_dependency "guard", "~> 1.0.1"
|
30
29
|
s.add_development_dependency "guard-spork"
|
data/lib/gmaps4rails.rb
CHANGED
@@ -8,6 +8,10 @@ module Gmaps4rails
|
|
8
8
|
ActionView::Base.send :include, Gmaps4railsHelper
|
9
9
|
end
|
10
10
|
|
11
|
+
initializer "deprecation warning" do |app|
|
12
|
+
warn "[Gmaps4rails DEPRECATION]: Javascript Gmaps.map.map is now deprecated and will be removed in later version. Please use Gmaps.map.serviceObject instead."
|
13
|
+
end
|
14
|
+
|
11
15
|
end
|
12
16
|
|
13
17
|
class Railtie < Rails::Railtie
|
@@ -88,7 +88,7 @@ module Gmaps4rails
|
|
88
88
|
model_attributes.each do |json_name, method_name|
|
89
89
|
if @object.respond_to? method_name
|
90
90
|
if json_name == :marker_picture
|
91
|
-
@json_hash.merge!(@object.send(method_name))
|
91
|
+
@json_hash.merge!(@object.send(method_name)) unless @json_hash.has_key? "picture"
|
92
92
|
else
|
93
93
|
@json_hash[json_name] = @object.send(method_name) unless @json_hash.has_key? json_name
|
94
94
|
end
|
data/lib/gmaps4rails/version.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
1
3
|
module Gmaps4rails
|
2
4
|
|
3
5
|
class ViewHelper
|
@@ -37,7 +39,7 @@ module Gmaps4rails
|
|
37
39
|
|
38
40
|
# outputs an object containing the basic information to fill the map's dom attributes
|
39
41
|
def dom_attributes
|
40
|
-
OpenStruct.new({
|
42
|
+
::OpenStruct.new({
|
41
43
|
:map_id => map_id,
|
42
44
|
:map_class => map_class,
|
43
45
|
:container_class => container_class,
|
@@ -29,6 +29,7 @@
|
|
29
29
|
|
30
30
|
function Gmaps4Rails() {
|
31
31
|
this.map = null;
|
32
|
+
this.serviceObject = null;
|
32
33
|
this.visibleInfoWindow = null;
|
33
34
|
this.userLocation = null;
|
34
35
|
this.geolocationFailure = function() {
|
@@ -82,7 +83,8 @@
|
|
82
83
|
}
|
83
84
|
|
84
85
|
Gmaps4Rails.prototype.initialize = function() {
|
85
|
-
this.
|
86
|
+
this.serviceObject = this.createMap();
|
87
|
+
this.map = this.serviceObject;
|
86
88
|
if (this.map_options.detect_location === true || this.map_options.center_on_user === true) {
|
87
89
|
this.findUserLocation(this);
|
88
90
|
}
|
@@ -111,7 +113,7 @@
|
|
111
113
|
var directionsDisplay, directionsService, request;
|
112
114
|
directionsDisplay = new google.maps.DirectionsRenderer();
|
113
115
|
directionsService = new google.maps.DirectionsService();
|
114
|
-
directionsDisplay.setMap(this.
|
116
|
+
directionsDisplay.setMap(this.serviceObject);
|
115
117
|
if (this.direction_conf.display_panel) {
|
116
118
|
directionsDisplay.setPanel(document.getElementById(this.direction_conf.panel_id));
|
117
119
|
}
|
@@ -182,7 +184,7 @@
|
|
182
184
|
radius: circle.radius
|
183
185
|
});
|
184
186
|
circle.serviceObject = newCircle;
|
185
|
-
return newCircle.setMap(this.
|
187
|
+
return newCircle.setMap(this.serviceObject);
|
186
188
|
}
|
187
189
|
};
|
188
190
|
|
@@ -228,7 +230,7 @@
|
|
228
230
|
};
|
229
231
|
|
230
232
|
Gmaps4Rails.prototype.show_circle = function(circle) {
|
231
|
-
return circle.serviceObject.setMap(this.
|
233
|
+
return circle.serviceObject.setMap(this.serviceObject);
|
232
234
|
};
|
233
235
|
|
234
236
|
Gmaps4Rails.prototype.create_polygons = function() {
|
@@ -266,7 +268,7 @@
|
|
266
268
|
fillColor: fillColor,
|
267
269
|
fillOpacity: fillOpacity,
|
268
270
|
clickable: clickable,
|
269
|
-
map: this.
|
271
|
+
map: this.serviceObject
|
270
272
|
});
|
271
273
|
return polygon.serviceObject = new_poly;
|
272
274
|
};
|
@@ -333,7 +335,7 @@
|
|
333
335
|
zIndex: zIndex
|
334
336
|
});
|
335
337
|
polyline.serviceObject = new_poly;
|
336
|
-
return new_poly.setMap(this.
|
338
|
+
return new_poly.setMap(this.serviceObject);
|
337
339
|
};
|
338
340
|
|
339
341
|
Gmaps4Rails.prototype.create_markers = function() {
|
@@ -475,7 +477,7 @@
|
|
475
477
|
map_center = this.boundsObject.getCenter();
|
476
478
|
this.map_options.center_latitude = map_center.lat();
|
477
479
|
this.map_options.center_longitude = map_center.lng();
|
478
|
-
return this.
|
480
|
+
return this.serviceObject.setCenter(map_center);
|
479
481
|
} else {
|
480
482
|
return this.fitBounds();
|
481
483
|
}
|
@@ -188,21 +188,21 @@
|
|
188
188
|
};
|
189
189
|
|
190
190
|
Gmaps4RailsBing.prototype.fitBounds = function() {
|
191
|
-
return this.
|
191
|
+
return this.serviceObject.setView({
|
192
192
|
bounds: this.boundsObject
|
193
193
|
});
|
194
194
|
};
|
195
195
|
|
196
196
|
Gmaps4RailsBing.prototype.addToMap = function(object) {
|
197
|
-
return this.
|
197
|
+
return this.serviceObject.entities.push(object);
|
198
198
|
};
|
199
199
|
|
200
200
|
Gmaps4RailsBing.prototype.removeFromMap = function(object) {
|
201
|
-
return this.
|
201
|
+
return this.serviceObject.entities.remove(object);
|
202
202
|
};
|
203
203
|
|
204
204
|
Gmaps4RailsBing.prototype.centerMapOnUser = function() {
|
205
|
-
return this.
|
205
|
+
return this.serviceObject.setView({
|
206
206
|
center: this.userLocation
|
207
207
|
});
|
208
208
|
};
|
@@ -108,7 +108,7 @@
|
|
108
108
|
if (args.marker_picture === "" && args.rich_marker === null) {
|
109
109
|
defaultOptions = {
|
110
110
|
position: markerLatLng,
|
111
|
-
map: this.
|
111
|
+
map: this.serviceObject,
|
112
112
|
title: args.marker_title,
|
113
113
|
draggable: args.marker_draggable,
|
114
114
|
zIndex: args.zindex
|
@@ -119,7 +119,7 @@
|
|
119
119
|
if (args.rich_marker !== null) {
|
120
120
|
return new RichMarker({
|
121
121
|
position: markerLatLng,
|
122
|
-
map: this.
|
122
|
+
map: this.serviceObject,
|
123
123
|
draggable: args.marker_draggable,
|
124
124
|
content: args.rich_marker,
|
125
125
|
flat: args.marker_anchor === null ? false : args.marker_anchor[1],
|
@@ -133,7 +133,7 @@
|
|
133
133
|
shadowImage = this.createOrRetrieveImage(args.shadow_picture, args.shadow_width, args.shadow_height, shadowAnchorPosition);
|
134
134
|
defaultOptions = {
|
135
135
|
position: markerLatLng,
|
136
|
-
map: this.
|
136
|
+
map: this.serviceObject,
|
137
137
|
icon: markerImage,
|
138
138
|
title: args.marker_title,
|
139
139
|
draggable: args.marker_draggable,
|
@@ -230,7 +230,7 @@
|
|
230
230
|
};
|
231
231
|
|
232
232
|
Gmaps4RailsGoogle.prototype.createClusterer = function(markers_array) {
|
233
|
-
return new MarkerClusterer(this.
|
233
|
+
return new MarkerClusterer(this.serviceObject, markers_array, {
|
234
234
|
maxZoom: this.markers_conf.clusterer_maxZoom,
|
235
235
|
gridSize: this.markers_conf.clusterer_gridSize,
|
236
236
|
styles: this.customClusterer()
|
@@ -283,7 +283,7 @@
|
|
283
283
|
if (currentMap.visibleInfoWindow !== null) {
|
284
284
|
currentMap.visibleInfoWindow.close();
|
285
285
|
}
|
286
|
-
infoWindow.open(currentMap.
|
286
|
+
infoWindow.open(currentMap.serviceObject, marker);
|
287
287
|
return currentMap.visibleInfoWindow = infoWindow;
|
288
288
|
};
|
289
289
|
};
|
@@ -293,18 +293,18 @@
|
|
293
293
|
kml_options = kml.options || {};
|
294
294
|
kml_options = this.mergeObjectWithDefault(kml_options, this.kml_options);
|
295
295
|
kml = new google.maps.KmlLayer(kml.url, kml_options);
|
296
|
-
kml.setMap(this.
|
296
|
+
kml.setMap(this.serviceObject);
|
297
297
|
return kml;
|
298
298
|
};
|
299
299
|
|
300
300
|
Gmaps4RailsGoogle.prototype.fitBounds = function() {
|
301
301
|
if (!this.boundsObject.isEmpty()) {
|
302
|
-
return this.
|
302
|
+
return this.serviceObject.fitBounds(this.boundsObject);
|
303
303
|
}
|
304
304
|
};
|
305
305
|
|
306
306
|
Gmaps4RailsGoogle.prototype.centerMapOnUser = function() {
|
307
|
-
return this.
|
307
|
+
return this.serviceObject.setCenter(this.userLocation);
|
308
308
|
};
|
309
309
|
|
310
310
|
return Gmaps4RailsGoogle;
|
@@ -139,22 +139,24 @@
|
|
139
139
|
};
|
140
140
|
|
141
141
|
Gmaps4RailsMapquest.prototype.fitBounds = function() {
|
142
|
-
if (this.markers.length >= 2)
|
142
|
+
if (this.markers.length >= 2) {
|
143
|
+
this.serviceObject.zoomToRect(this.boundsObject);
|
144
|
+
}
|
143
145
|
if (this.markers.length === 1) {
|
144
|
-
return this.
|
146
|
+
return this.serviceObject.setCenter(this.markers[0].serviceObject.latLng);
|
145
147
|
}
|
146
148
|
};
|
147
149
|
|
148
150
|
Gmaps4RailsMapquest.prototype.centerMapOnUser = function() {
|
149
|
-
return this.
|
151
|
+
return this.serviceObject.setCenter(this.userLocation);
|
150
152
|
};
|
151
153
|
|
152
154
|
Gmaps4RailsMapquest.prototype.addToMap = function(object) {
|
153
|
-
return this.
|
155
|
+
return this.serviceObject.addShape(object);
|
154
156
|
};
|
155
157
|
|
156
158
|
Gmaps4RailsMapquest.prototype.removeFromMap = function(object) {
|
157
|
-
return this.
|
159
|
+
return this.serviceObject.removeShape(object);
|
158
160
|
};
|
159
161
|
|
160
162
|
return Gmaps4RailsMapquest;
|
@@ -50,11 +50,11 @@
|
|
50
50
|
style_mark.fillOpacity = 1;
|
51
51
|
if (this.markersLayer === null) {
|
52
52
|
this.markersLayer = new OpenLayers.Layer.Vector("Markers", null);
|
53
|
-
this.
|
53
|
+
this.serviceObject.addLayer(this.markersLayer);
|
54
54
|
this.markersLayer.events.register("featureselected", this.markersLayer, this.onFeatureSelect);
|
55
55
|
this.markersLayer.events.register("featureunselected", this.markersLayer, this.onFeatureUnselect);
|
56
56
|
this.markersControl = new OpenLayers.Control.SelectFeature(this.markersLayer);
|
57
|
-
this.
|
57
|
+
this.serviceObject.addControl(this.markersControl);
|
58
58
|
this.markersControl.activate();
|
59
59
|
}
|
60
60
|
if (args.marker_picture === "") {
|
@@ -92,8 +92,8 @@
|
|
92
92
|
};
|
93
93
|
|
94
94
|
Gmaps4RailsOpenlayers.prototype.clearMarkersLayerIfExists = function() {
|
95
|
-
if (this.markersLayer !== null && this.
|
96
|
-
return this.
|
95
|
+
if (this.markersLayer !== null && this.serviceObject.getLayer(this.markersLayer.id) !== null) {
|
96
|
+
return this.serviceObject.removeLayer(this.markersLayer);
|
97
97
|
}
|
98
98
|
};
|
99
99
|
|
@@ -147,7 +147,7 @@
|
|
147
147
|
})
|
148
148
|
});
|
149
149
|
this.clearMarkersLayerIfExists();
|
150
|
-
this.
|
150
|
+
this.serviceObject.addLayer(clusters);
|
151
151
|
clusters.addFeatures(markers_array);
|
152
152
|
return clusters;
|
153
153
|
};
|
@@ -167,7 +167,7 @@
|
|
167
167
|
};
|
168
168
|
|
169
169
|
Gmaps4RailsOpenlayers.prototype.clearClusterer = function() {
|
170
|
-
return this.
|
170
|
+
return this.serviceObject.removeLayer(this.markerClusterer);
|
171
171
|
};
|
172
172
|
|
173
173
|
Gmaps4RailsOpenlayers.prototype.createInfoWindow = function(marker_container) {
|
@@ -186,25 +186,25 @@
|
|
186
186
|
popup = new OpenLayers.Popup.FramedCloud("featurePopup", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(300, 200), feature.infoWindow, null, true, this.onPopupClose);
|
187
187
|
feature.popup = popup;
|
188
188
|
popup.feature = feature;
|
189
|
-
return this.
|
189
|
+
return this.serviceObject.addPopup(popup);
|
190
190
|
};
|
191
191
|
|
192
192
|
Gmaps4RailsOpenlayers.prototype.onFeatureUnselect = function(evt) {
|
193
193
|
var feature;
|
194
194
|
feature = evt.feature;
|
195
195
|
if (feature.popup) {
|
196
|
-
this.
|
196
|
+
this.serviceObject.removePopup(feature.popup);
|
197
197
|
feature.popup.destroy();
|
198
198
|
return feature.popup = null;
|
199
199
|
}
|
200
200
|
};
|
201
201
|
|
202
202
|
Gmaps4RailsOpenlayers.prototype.fitBounds = function() {
|
203
|
-
return this.
|
203
|
+
return this.serviceObject.zoomToExtent(this.boundsObject, true);
|
204
204
|
};
|
205
205
|
|
206
206
|
Gmaps4RailsOpenlayers.prototype.centerMapOnUser = function() {
|
207
|
-
return this.
|
207
|
+
return this.serviceObject.setCenter(this.userLocation);
|
208
208
|
};
|
209
209
|
|
210
210
|
return Gmaps4RailsOpenlayers;
|
@@ -8,6 +8,11 @@ class UsersController < ApplicationController
|
|
8
8
|
@users = User.all
|
9
9
|
@json = @users.to_gmaps4rails do |user, marker|
|
10
10
|
marker.json({:id => user.id })
|
11
|
+
marker.picture({
|
12
|
+
"picture" => "/logo.png",
|
13
|
+
"width" => 32,
|
14
|
+
"height" => 32})
|
15
|
+
marker.infowindow user.name
|
11
16
|
end
|
12
17
|
respond_with @json
|
13
18
|
end
|
@@ -65,7 +65,7 @@ window.onload =alert('ok');
|
|
65
65
|
}) %>
|
66
66
|
<%#= gmaps( :map_options => {:auto_adjust=>true, :auto_zoom=>true}, :markers => {:data=>"[{\"lat\":43.5368851,\"lng\":-79.6849913}]"}, :circles => {:data=>"[{\"lng\":-79.6849913,\"lat\":43.5368851,\"radius\":5000.0,\"strokeColor\":\"#DD3300\"}]", :options=>{:fillOpacity=>0.35}} )
|
67
67
|
%>
|
68
|
-
|
68
|
+
<%#= gmaps4rails(@json) %>
|
69
69
|
<%#= gmaps(:markers => {:data => @json}, :map_options => { :detect_location => true, :auto_zoom => false, :zoom => 15, :auto_adjust => true, :center_on_user => true}) %>
|
70
70
|
<%#= gmaps(:map_options => { :auto_adjust => true },
|
71
71
|
:markers => {
|
@@ -75,7 +75,7 @@ window.onload =alert('ok');
|
|
75
75
|
|
76
76
|
<%#= gmaps( {:map_options => { :disableDefaultUI => true, :auto_adjust => true, :center_on_user => true, :detect_location => true, :center_latitude => 41.574361,
|
77
77
|
:center_longitude => -72.949219 }}) %>
|
78
|
-
|
78
|
+
<%= gmaps(:markers => {:data => @json, :options => {:do_clustering => false, "custom_infowindow_class" => "yellow", :raw => "{ flat: true, draggable: true}" } },
|
79
79
|
:polygons => {:data => '[[
|
80
80
|
{"lng": 5.190262, "lat": 25.774252},
|
81
81
|
{"lng": 7.118292, "lat": 45.466465},
|
@@ -130,89 +130,88 @@ window.onload =alert('ok');
|
|
130
130
|
// Gmaps.map.jsTemplate = function(marker_container){
|
131
131
|
// return "ok";
|
132
132
|
// }
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
// }};
|
133
|
+
|
134
|
+
function HomeControl(controlDiv, map) {
|
135
|
+
var chicago = new google.maps.LatLng(41.850033, -87.6500523);
|
136
|
+
|
137
|
+
// Set CSS styles for the DIV containing the control
|
138
|
+
// Setting padding to 5 px will offset the control
|
139
|
+
// from the edge of the map.
|
140
|
+
controlDiv.style.padding = '5px';
|
141
|
+
|
142
|
+
// Set CSS for the control border.
|
143
|
+
var controlUI = document.createElement('DIV');
|
144
|
+
controlUI.style.backgroundColor = 'white';
|
145
|
+
controlUI.style.borderStyle = 'solid';
|
146
|
+
controlUI.style.borderWidth = '2px';
|
147
|
+
controlUI.style.cursor = 'pointer';
|
148
|
+
controlUI.style.textAlign = 'center';
|
149
|
+
controlUI.title = 'Click to set the map to Home';
|
150
|
+
controlDiv.appendChild(controlUI);
|
151
|
+
|
152
|
+
// Set CSS for the control interior.
|
153
|
+
var controlText = document.createElement('DIV');
|
154
|
+
controlText.style.fontFamily = 'Arial,sans-serif';
|
155
|
+
controlText.style.fontSize = '12px';
|
156
|
+
controlText.style.paddingLeft = '4px';
|
157
|
+
controlText.style.paddingRight = '4px';
|
158
|
+
controlText.innerHTML = 'Home';
|
159
|
+
controlUI.appendChild(controlText);
|
160
|
+
|
161
|
+
// Setup the click event listeners: simply set the map to Chicago.
|
162
|
+
google.maps.event.addDomListener(controlUI, 'click', function() {
|
163
|
+
map.setCenter(chicago)
|
164
|
+
});
|
165
|
+
}
|
166
|
+
|
167
|
+
Gmaps.map.callback = function(){
|
168
|
+
// Create the DIV to hold the control and call the HomeControl() constructor
|
169
|
+
// passing in this DIV.
|
170
|
+
var homeControlDiv = document.createElement('DIV');
|
171
|
+
var homeControl = new HomeControl(homeControlDiv, Gmaps.map.map);
|
172
|
+
|
173
|
+
homeControlDiv.index = 1;
|
174
|
+
Gmaps.map.map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
|
175
|
+
};
|
176
|
+
|
177
|
+
|
178
|
+
var pinkParksStyles = [
|
179
|
+
{
|
180
|
+
featureType: "all",
|
181
|
+
stylers: [
|
182
|
+
{ saturation: -80 }
|
183
|
+
]
|
184
|
+
},
|
185
|
+
{
|
186
|
+
featureType: "poi.park",
|
187
|
+
stylers: [
|
188
|
+
{ hue: "#ff0023" },
|
189
|
+
{ saturation: 40 }
|
190
|
+
]
|
191
|
+
}
|
192
|
+
];
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
Gmaps.map.infobox = function(boxText) {
|
197
|
+
return {
|
198
|
+
content: boxText
|
199
|
+
,disableAutoPan: false
|
200
|
+
,maxWidth: 0
|
201
|
+
,pixelOffset: new google.maps.Size(-140, 0)
|
202
|
+
,zIndex: null
|
203
|
+
,boxStyle: {
|
204
|
+
background: "url('http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.5/examples/tipbox.gif') no-repeat"
|
205
|
+
,opacity: 0.75
|
206
|
+
,width: "280px"
|
207
|
+
}
|
208
|
+
,closeBoxMargin: "10px 2px 2px 2px"
|
209
|
+
,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif"
|
210
|
+
,infoBoxClearance: new google.maps.Size(1, 1)
|
211
|
+
,isHidden: false
|
212
|
+
,pane: "floatPane"
|
213
|
+
,enableEventPropagation: false
|
214
|
+
}};
|
216
215
|
|
217
216
|
</script>
|
218
217
|
<script type="text/javascript" charset="utf-8">
|
Binary file
|
@@ -80,7 +80,7 @@ describe("Gmaps4Rails", function() {
|
|
80
80
|
for (var i = 0; i < 100; ++i) {
|
81
81
|
var x = gmap.randomize(0,0);
|
82
82
|
var distanceInMeters = geoHelpers.getDistanceFromO(x[0], x[1])/1000;
|
83
|
-
//this test
|
83
|
+
//this test could seem weird, but because latitude AND longitude could be moved by 100m, the highest diagonal is 142m
|
84
84
|
expect(distanceInMeters).toBeLessThan(142);
|
85
85
|
}
|
86
86
|
});
|
@@ -110,13 +110,13 @@ describe("createServiceMarkersFromMarkers full stack", function() {
|
|
110
110
|
|
111
111
|
afterEach(function() {
|
112
112
|
clearMarkerTraces();
|
113
|
-
gmap.
|
113
|
+
gmap.serviceObject = null;
|
114
114
|
});
|
115
115
|
|
116
116
|
it("should process all attributes from a marker (without default values)", function() {
|
117
117
|
var marker = getFullMarker();
|
118
118
|
gmap.markers = [marker];
|
119
|
-
gmap.
|
119
|
+
gmap.serviceObject = "map";
|
120
120
|
|
121
121
|
spyOn(gmap, "createMarker");
|
122
122
|
|
@@ -145,7 +145,7 @@ describe("createServiceMarkersFromMarkers full stack", function() {
|
|
145
145
|
it("should process all attributes from a marker (with default values)", function() {
|
146
146
|
var marker = getEmptyMarker();
|
147
147
|
gmap.markers = [marker];
|
148
|
-
gmap.
|
148
|
+
gmap.serviceObject = "map";
|
149
149
|
|
150
150
|
spyOn(gmap, "createMarker");
|
151
151
|
|
@@ -1,76 +1,10 @@
|
|
1
|
-
# src_files
|
2
|
-
#
|
3
|
-
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
4
|
-
# Default: []
|
5
|
-
#
|
6
|
-
# EXAMPLE:
|
7
|
-
#
|
8
|
-
# src_files:
|
9
|
-
# - lib/source1.js
|
10
|
-
# - lib/source2.js
|
11
|
-
# - dist/**/*.js
|
12
|
-
#
|
13
1
|
src_files:
|
14
2
|
- public/javascripts/**/*.js
|
15
3
|
|
16
|
-
# stylesheets
|
17
|
-
#
|
18
|
-
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
|
19
|
-
# Default: []
|
20
|
-
#
|
21
|
-
# EXAMPLE:
|
22
|
-
#
|
23
|
-
# stylesheets:
|
24
|
-
# - css/style.css
|
25
|
-
# - stylesheets/*.css
|
26
|
-
#
|
27
|
-
stylesheets:
|
28
|
-
- stylesheets/**/*.css
|
29
|
-
|
30
|
-
# helpers
|
31
|
-
#
|
32
|
-
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
33
|
-
# Default: ["helpers/**/*.js"]
|
34
|
-
#
|
35
|
-
# EXAMPLE:
|
36
|
-
#
|
37
|
-
# helpers:
|
38
|
-
# - helpers/**/*.js
|
39
|
-
#
|
40
4
|
helpers:
|
41
5
|
- helpers/**/*.js
|
42
6
|
|
43
|
-
# spec_files
|
44
|
-
#
|
45
|
-
# Return an array of filepaths relative to spec_dir to include.
|
46
|
-
# Default: ["**/*[sS]pec.js"]
|
47
|
-
#
|
48
|
-
# EXAMPLE:
|
49
|
-
#
|
50
|
-
# spec_files:
|
51
|
-
# - **/*[sS]pec.js
|
52
|
-
#
|
53
7
|
spec_files:
|
54
|
-
- '**/*
|
55
|
-
|
56
|
-
# src_dir
|
57
|
-
#
|
58
|
-
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
59
|
-
# Default: project root
|
60
|
-
#
|
61
|
-
# EXAMPLE:
|
62
|
-
#
|
63
|
-
# src_dir: public
|
64
|
-
#
|
65
|
-
src_dir:
|
8
|
+
- '**/*spec.js'
|
66
9
|
|
67
|
-
# spec_dir
|
68
|
-
#
|
69
|
-
# Spec directory path. Your spec_files must be returned relative to this path.
|
70
|
-
# Default: spec/javascripts
|
71
|
-
#
|
72
|
-
# EXAMPLE:
|
73
|
-
#
|
74
|
-
# spec_dir: spec/javascripts
|
75
|
-
#
|
76
10
|
spec_dir: spec/javascripts
|
data/spec/models/user_spec.rb
CHANGED
@@ -9,7 +9,7 @@ DEFAULT_CONFIG_HASH = {
|
|
9
9
|
:checker => "gmaps",
|
10
10
|
:msg => "Address invalid",
|
11
11
|
:validation => true,
|
12
|
-
:address => "
|
12
|
+
:address => "address",
|
13
13
|
:language => "en",
|
14
14
|
:protocol => "http",
|
15
15
|
:process_geocoding => true
|
@@ -231,7 +231,7 @@ describe Gmaps4rails::ActsAsGmappable do
|
|
231
231
|
it "should display the proper error message when address is invalid" do
|
232
232
|
set_gmaps4rails_options!({ :msg => "Custom Address invalid"})
|
233
233
|
invalid_user.should_not be_valid
|
234
|
-
invalid_user.errors[:
|
234
|
+
invalid_user.errors[:address].should include("Custom Address invalid")
|
235
235
|
end
|
236
236
|
|
237
237
|
it "should not raise an error if validation option is turned off" do
|
@@ -396,6 +396,26 @@ describe Gmaps4rails::ActsAsGmappable do
|
|
396
396
|
result.should_not include "defined in model"
|
397
397
|
end
|
398
398
|
|
399
|
+
it "block info should take precedence over model methods, particular case: picture" do
|
400
|
+
user.instance_eval do
|
401
|
+
def gmaps4rails_marker_picture
|
402
|
+
{
|
403
|
+
"picture" => "/model.png",
|
404
|
+
"width" => 32,
|
405
|
+
"height" => 32}
|
406
|
+
end
|
407
|
+
end
|
408
|
+
user.to_gmaps4rails.should include "model.png"
|
409
|
+
result = user.to_gmaps4rails do |u, marker|
|
410
|
+
marker.picture({
|
411
|
+
"picture" => "/block.png",
|
412
|
+
"width" => 32,
|
413
|
+
"height" => 32})
|
414
|
+
end
|
415
|
+
result.should include "block.png"
|
416
|
+
result.should_not include "model.png"
|
417
|
+
end
|
418
|
+
|
399
419
|
end
|
400
420
|
|
401
421
|
describe "eval conditions" do
|
data/spec/spec_helper.rb
CHANGED
@@ -13,7 +13,6 @@ Spork.prefork do
|
|
13
13
|
|
14
14
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f }
|
15
15
|
FactoryGirl.definition_file_paths = [ File.join(Rails.root, '../factories') ]
|
16
|
-
FactoryGirl.find_definitions
|
17
16
|
|
18
17
|
RSpec.configure do |config|
|
19
18
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmaps4rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.0.
|
4
|
+
version: 1.5.0.pre2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-05-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -44,22 +44,6 @@ dependencies:
|
|
44
44
|
- - ! '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: jquery-rails
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
type: :development
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ! '>='
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
47
|
- !ruby/object:Gem::Dependency
|
64
48
|
name: rspec-rails
|
65
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,22 +76,6 @@ dependencies:
|
|
92
76
|
- - ! '>='
|
93
77
|
- !ruby/object:Gem::Version
|
94
78
|
version: '0'
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: jasmine
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
|
-
requirements:
|
100
|
-
- - ! '>='
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
103
|
-
type: :development
|
104
|
-
prerelease: false
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
|
-
requirements:
|
108
|
-
- - ! '>='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
79
|
- !ruby/object:Gem::Dependency
|
112
80
|
name: guard
|
113
81
|
requirement: !ruby/object:Gem::Requirement
|
@@ -283,10 +251,6 @@ files:
|
|
283
251
|
- spec/dummy/app/models/user.rb
|
284
252
|
- spec/dummy/app/views/layouts/application.html.erb
|
285
253
|
- spec/dummy/app/views/users/_form.html.erb
|
286
|
-
- spec/dummy/app/views/users/_my_template.html.erb
|
287
|
-
- spec/dummy/app/views/users/_my_template2.html.erb
|
288
|
-
- spec/dummy/app/views/users/ajax_data.js.erb
|
289
|
-
- spec/dummy/app/views/users/ajax_test.html.erb
|
290
254
|
- spec/dummy/app/views/users/edit.html.erb
|
291
255
|
- spec/dummy/app/views/users/index.html.erb
|
292
256
|
- spec/dummy/app/views/users/new.html.erb
|
@@ -317,6 +281,7 @@ files:
|
|
317
281
|
- spec/dummy/public/favicon.ico
|
318
282
|
- spec/dummy/public/javascripts/Player.js
|
319
283
|
- spec/dummy/public/javascripts/Song.js
|
284
|
+
- spec/dummy/public/logo.png
|
320
285
|
- spec/dummy/script/rails
|
321
286
|
- spec/factories/user_factory.rb
|
322
287
|
- spec/javascripts/basic_methods_spec.js
|
@@ -347,6 +312,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
347
312
|
- - ! '>='
|
348
313
|
- !ruby/object:Gem::Version
|
349
314
|
version: '0'
|
315
|
+
segments:
|
316
|
+
- 0
|
317
|
+
hash: 2295245058499168094
|
350
318
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
351
319
|
none: false
|
352
320
|
requirements:
|
@@ -377,10 +345,6 @@ test_files:
|
|
377
345
|
- spec/dummy/app/models/user.rb
|
378
346
|
- spec/dummy/app/views/layouts/application.html.erb
|
379
347
|
- spec/dummy/app/views/users/_form.html.erb
|
380
|
-
- spec/dummy/app/views/users/_my_template.html.erb
|
381
|
-
- spec/dummy/app/views/users/_my_template2.html.erb
|
382
|
-
- spec/dummy/app/views/users/ajax_data.js.erb
|
383
|
-
- spec/dummy/app/views/users/ajax_test.html.erb
|
384
348
|
- spec/dummy/app/views/users/edit.html.erb
|
385
349
|
- spec/dummy/app/views/users/index.html.erb
|
386
350
|
- spec/dummy/app/views/users/new.html.erb
|
@@ -411,6 +375,7 @@ test_files:
|
|
411
375
|
- spec/dummy/public/favicon.ico
|
412
376
|
- spec/dummy/public/javascripts/Player.js
|
413
377
|
- spec/dummy/public/javascripts/Song.js
|
378
|
+
- spec/dummy/public/logo.png
|
414
379
|
- spec/dummy/script/rails
|
415
380
|
- spec/factories/user_factory.rb
|
416
381
|
- spec/javascripts/basic_methods_spec.js
|
@@ -1 +0,0 @@
|
|
1
|
-
<b>"ok man"</b>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<%= gmaps({:last_map => false}) %>
|
2
|
-
|
3
|
-
|
4
|
-
<button type="button" id="ajax">Replace Markers</button>
|
5
|
-
|
6
|
-
<script type="text/javascript" charset="utf-8">
|
7
|
-
$(function() {
|
8
|
-
|
9
|
-
$(".map_container").hide();
|
10
|
-
|
11
|
-
|
12
|
-
$("#ajax").click(function(){
|
13
|
-
$.getJSON('/users', function(response){
|
14
|
-
$(".map_container").show();
|
15
|
-
Gmaps.map.initialize();
|
16
|
-
Gmaps.map.addMarkers(response);
|
17
|
-
})
|
18
|
-
|
19
|
-
})
|
20
|
-
});</script>
|
21
|
-
|
22
|
-
<!-- -->
|