gmaps4rails 0.11.1 → 1.0.0

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.
Files changed (65) hide show
  1. data/README.rdoc +6 -2
  2. data/app/views/gmaps4rails/_gmaps4rails.html.erb +18 -20
  3. data/lib/gmaps4rails/base.rb +95 -0
  4. data/lib/gmaps4rails/extensions/hash.rb +3 -67
  5. data/lib/gmaps4rails/helper/gmaps4rails_helper.rb +13 -2
  6. data/public/javascripts/gmaps4rails/all_apis.js +5 -0
  7. data/public/javascripts/gmaps4rails/gmaps4rails.base.js +147 -112
  8. data/public/javascripts/gmaps4rails/gmaps4rails.bing.js +182 -171
  9. data/public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js +269 -235
  10. data/public/javascripts/gmaps4rails/gmaps4rails.mapquest.js +135 -125
  11. data/public/javascripts/gmaps4rails/gmaps4rails.openlayers.js +227 -218
  12. data/public/stylesheets/gmaps4rails.css +2 -2
  13. metadata +9 -111
  14. data/test/dummy/app/controllers/application_controller.rb +0 -3
  15. data/test/dummy/app/controllers/users_controller.rb +0 -60
  16. data/test/dummy/app/helpers/application_helper.rb +0 -2
  17. data/test/dummy/app/helpers/users_helper.rb +0 -3
  18. data/test/dummy/app/models/user.rb +0 -38
  19. data/test/dummy/config/application.rb +0 -41
  20. data/test/dummy/config/boot.rb +0 -6
  21. data/test/dummy/config/environment.rb +0 -5
  22. data/test/dummy/config/environments/development.rb +0 -26
  23. data/test/dummy/config/environments/production.rb +0 -49
  24. data/test/dummy/config/environments/test.rb +0 -35
  25. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  26. data/test/dummy/config/initializers/inflections.rb +0 -10
  27. data/test/dummy/config/initializers/mime_types.rb +0 -5
  28. data/test/dummy/config/initializers/secret_token.rb +0 -7
  29. data/test/dummy/config/initializers/session_store.rb +0 -8
  30. data/test/dummy/config/routes.rb +0 -7
  31. data/test/dummy/db/migrate/20110306182914_create_users.rb +0 -21
  32. data/test/dummy/db/migrate/20110430081624_add_addresses_to_users.rb +0 -11
  33. data/test/dummy/db/migrate/20110430083824_remove_address_from_users.rb +0 -9
  34. data/test/dummy/db/schema.rb +0 -35
  35. data/test/dummy/db/seeds.rb +0 -7
  36. data/test/dummy/spec/base/base_spec.rb +0 -127
  37. data/test/dummy/spec/helpers/gmaps4rails_helper_spec.rb +0 -13
  38. data/test/dummy/spec/javascripts/support/jasmine_config.rb +0 -23
  39. data/test/dummy/spec/javascripts/support/jasmine_runner.rb +0 -20
  40. data/test/dummy/spec/models/user_spec.rb +0 -284
  41. data/test/dummy/spec/requests/users_spec.rb +0 -22
  42. data/test/dummy/spec/spec_helper.rb +0 -41
  43. data/test/dummy/spec/support/factories.rb +0 -20
  44. data/test/dummy/spec/support/matchers.rb +0 -7
  45. data/test/dummy31/app/controllers/application_controller.rb +0 -3
  46. data/test/dummy31/app/controllers/users_controller.rb +0 -83
  47. data/test/dummy31/app/helpers/application_helper.rb +0 -2
  48. data/test/dummy31/app/helpers/users_helper.rb +0 -2
  49. data/test/dummy31/app/models/user.rb +0 -7
  50. data/test/dummy31/config/application.rb +0 -43
  51. data/test/dummy31/config/boot.rb +0 -6
  52. data/test/dummy31/config/environment.rb +0 -5
  53. data/test/dummy31/config/environments/development.rb +0 -27
  54. data/test/dummy31/config/environments/production.rb +0 -51
  55. data/test/dummy31/config/environments/test.rb +0 -39
  56. data/test/dummy31/config/initializers/backtrace_silencers.rb +0 -7
  57. data/test/dummy31/config/initializers/inflections.rb +0 -10
  58. data/test/dummy31/config/initializers/mime_types.rb +0 -5
  59. data/test/dummy31/config/initializers/secret_token.rb +0 -7
  60. data/test/dummy31/config/initializers/session_store.rb +0 -8
  61. data/test/dummy31/config/initializers/wrap_parameters.rb +0 -12
  62. data/test/dummy31/config/routes.rb +0 -61
  63. data/test/dummy31/db/migrate/20110809134019_create_users.rb +0 -13
  64. data/test/dummy31/db/schema.rb +0 -25
  65. data/test/dummy31/db/seeds.rb +0 -7
@@ -1,259 +1,268 @@
1
- ////////////////////////////////////////////////////
2
- /////////////// Abstracting API calls //////////////
3
- //(for maybe an extension to another map provider)//
4
- //////////////////mocks created/////////////////////
5
- // http://wiki.openstreetmap.org/wiki/OpenLayers
6
- // http://openlayers.org/dev/examples
7
- //http://docs.openlayers.org/contents.html
1
+ var Gmaps4RailsOpenlayers = function() {
8
2
 
9
- Gmaps4Rails.openMarkers = null;
10
- Gmaps4Rails.markersLayer = null;
11
- Gmaps4Rails.markersControl = null;
3
+ ////////////////////////////////////////////////////
4
+ /////////////// Abstracting API calls //////////////
5
+ //(for maybe an extension to another map provider)//
6
+ //////////////////mocks created/////////////////////
7
+ // http://wiki.openstreetmap.org/wiki/OpenLayers
8
+ // http://openlayers.org/dev/examples
9
+ //http://docs.openlayers.org/contents.html
10
+ this.map_options = {};
11
+ this.mergeWithDefault("map_options");
12
+ this.markers_conf = {};
13
+ this.mergeWithDefault("markers_conf");
14
+
15
+ this.openMarkers = null;
16
+ this.markersLayer = null;
17
+ this.markersControl = null;
12
18
 
13
- ////////////////////////////////////////////////////
14
- /////////////// Basic Objects ////////////////////
15
- ////////////////////////////////////////////////////
19
+ ////////////////////////////////////////////////////
20
+ /////////////// Basic Objects ////////////////////
21
+ ////////////////////////////////////////////////////
16
22
 
17
- Gmaps4Rails.createPoint = function(lat, lng){
18
- //return new Microsoft.Maps.Point(lat, lng);
19
- };
23
+ this.createPoint = function(lat, lng){
24
+ //return new Microsoft.Maps.Point(lat, lng);
25
+ };
20
26
 
21
- Gmaps4Rails.createLatLng = function(lat, lng){
22
- return new OpenLayers.LonLat(lng, lat)
23
- .transform(
24
- new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
25
- new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection
26
- );
27
- };
27
+ this.createLatLng = function(lat, lng){
28
+ return new OpenLayers.LonLat(lng, lat)
29
+ .transform(
30
+ new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
31
+ new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection
32
+ );
33
+ };
28
34
 
29
- Gmaps4Rails.createAnchor = function(offset){
30
- if (offset === null)
31
- { return null; }
32
- else {
33
- return new OpenLayers.Pixel(offset[0], offset[1]);
34
- }
35
- };
35
+ this.createAnchor = function(offset){
36
+ if (offset === null)
37
+ { return null; }
38
+ else {
39
+ return new OpenLayers.Pixel(offset[0], offset[1]);
40
+ }
41
+ };
36
42
 
37
- Gmaps4Rails.createSize = function(width, height){
38
- return new OpenLayers.Size(width, height);
39
- };
43
+ this.createSize = function(width, height){
44
+ return new OpenLayers.Size(width, height);
45
+ };
40
46
 
41
- Gmaps4Rails.createLatLngBounds = function(){
42
- return new OpenLayers.Bounds();
43
- };
47
+ this.createLatLngBounds = function(){
48
+ return new OpenLayers.Bounds();
49
+ };
44
50
 
45
- Gmaps4Rails.createMap = function(){
46
- //todo add customization: kind of map and other map options
47
- var map = new OpenLayers.Map(Gmaps4Rails.map_options.id);
48
- map.addLayer(new OpenLayers.Layer.OSM());
49
- map.setCenter(Gmaps4Rails.createLatLng(Gmaps4Rails.map_options.center_latitude, Gmaps4Rails.map_options.center_longitude), // Center of the map
50
- Gmaps4Rails.map_options.zoom // Zoom level
51
- );
52
- return map;
53
- };
51
+ this.createMap = function(){
52
+ //todo add customization: kind of map and other map options
53
+ var map = new OpenLayers.Map(this.map_options.id);
54
+ map.addLayer(new OpenLayers.Layer.OSM());
55
+ map.setCenter(this.createLatLng(this.map_options.center_latitude, this.map_options.center_longitude), // Center of the map
56
+ this.map_options.zoom // Zoom level
57
+ );
58
+ return map;
59
+ };
54
60
 
55
- ////////////////////////////////////////////////////
56
- ////////////////////// Markers /////////////////////
57
- ////////////////////////////////////////////////////
58
- //http://openlayers.org/dev/examples/marker-shadow.html
59
- Gmaps4Rails.createMarker = function(args){
61
+ ////////////////////////////////////////////////////
62
+ ////////////////////// Markers /////////////////////
63
+ ////////////////////////////////////////////////////
64
+ //http://openlayers.org/dev/examples/marker-shadow.html
65
+ this.createMarker = function(args){
60
66
 
61
- var style_mark = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
62
- style_mark.fillOpacity = 1;
67
+ var style_mark = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
68
+ style_mark.fillOpacity = 1;
63
69
 
64
- //creating markers' dedicated layer
65
- if (Gmaps4Rails.markersLayer === null) {
66
- Gmaps4Rails.markersLayer = new OpenLayers.Layer.Vector("Markers", null);
67
- Gmaps4Rails.map.addLayer(Gmaps4Rails.markersLayer);
68
- //TODO move?
69
- Gmaps4Rails.markersLayer.events.register("featureselected", Gmaps4Rails.markersLayer, Gmaps4Rails.onFeatureSelect);
70
- Gmaps4Rails.markersLayer.events.register("featureunselected", Gmaps4Rails.markersLayer, Gmaps4Rails.onFeatureUnselect);
70
+ //creating markers' dedicated layer
71
+ if (this.markersLayer === null) {
72
+ this.markersLayer = new OpenLayers.Layer.Vector("Markers", null);
73
+ this.map.addLayer(this.markersLayer);
74
+ //TODO move?
75
+ this.markersLayer.events.register("featureselected", this.markersLayer, this.onFeatureSelect);
76
+ this.markersLayer.events.register("featureunselected", this.markersLayer, this.onFeatureUnselect);
71
77
 
72
- Gmaps4Rails.markersControl = new OpenLayers.Control.SelectFeature(Gmaps4Rails.markersLayer);
73
- Gmaps4Rails.map.addControl(Gmaps4Rails.markersControl);
74
- Gmaps4Rails.markersControl.activate();
75
- }
76
- //showing default pic if none available
77
- if (args.marker_picture === "" ) {
78
- //style_mark.graphicWidth = 24;
79
- style_mark.graphicHeight = 30;
80
- style_mark.externalGraphic = "http://openlayers.org/dev/img/marker-blue.png";
81
- }
82
- //creating custom pic
83
- else {
84
- style_mark.graphicWidth = args.marker_width;
85
- style_mark.graphicHeight = args.marker_height;
86
- style_mark.externalGraphic = args.marker_picture;
87
- //adding anchor if any
88
- if (args.marker_anchor !== null ){
89
- style_mark.graphicXOffset = args.marker_anchor[0];
90
- style_mark.graphicYOffset = args.marker_anchor[1];
78
+ this.markersControl = new OpenLayers.Control.SelectFeature(this.markersLayer);
79
+ this.map.addControl(this.markersControl);
80
+ this.markersControl.activate();
91
81
  }
92
- //adding shadow if any
93
- if (args.shadow_picture !== ""){
94
- style_mark.backgroundGraphic = args.shadow_picture;
95
- style_mark.backgroundWidth = args.shadow_width;
96
- style_mark.backgroundHeight = args.shadow_height;
97
- //adding shadow's anchor if any
98
- if(args.shadow_anchor !== null) {
99
- style_mark.backgroundXOffset = args.shadow_anchor[0];
100
- style_mark.backgroundYOffset = args.shadow_anchor[1];
82
+ //showing default pic if none available
83
+ if (args.marker_picture === "" ) {
84
+ //style_mark.graphicWidth = 24;
85
+ style_mark.graphicHeight = 30;
86
+ style_mark.externalGraphic = "http://openlayers.org/dev/img/marker-blue.png";
87
+ }
88
+ //creating custom pic
89
+ else {
90
+ style_mark.graphicWidth = args.marker_width;
91
+ style_mark.graphicHeight = args.marker_height;
92
+ style_mark.externalGraphic = args.marker_picture;
93
+ //adding anchor if any
94
+ if (args.marker_anchor !== null ){
95
+ style_mark.graphicXOffset = args.marker_anchor[0];
96
+ style_mark.graphicYOffset = args.marker_anchor[1];
97
+ }
98
+ //adding shadow if any
99
+ if (args.shadow_picture !== ""){
100
+ style_mark.backgroundGraphic = args.shadow_picture;
101
+ style_mark.backgroundWidth = args.shadow_width;
102
+ style_mark.backgroundHeight = args.shadow_height;
103
+ //adding shadow's anchor if any
104
+ if(args.shadow_anchor !== null) {
105
+ style_mark.backgroundXOffset = args.shadow_anchor[0];
106
+ style_mark.backgroundYOffset = args.shadow_anchor[1];
107
+ }
101
108
  }
102
109
  }
103
- }
104
110
 
105
- style_mark.graphicTitle = args.title;
111
+ style_mark.graphicTitle = args.title;
106
112
 
107
- var marker = new OpenLayers.Feature.Vector(
108
- new OpenLayers.Geometry.Point(args.Lng, args.Lat),
109
- null,
110
- style_mark
111
- );
112
- //changing coordinates so that it actually appears on the map!
113
- marker.geometry.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
114
- //adding layer to the map
115
- Gmaps4Rails.markersLayer.addFeatures([marker]);
113
+ var marker = new OpenLayers.Feature.Vector(
114
+ new OpenLayers.Geometry.Point(args.Lng, args.Lat),
115
+ null,
116
+ style_mark
117
+ );
118
+ //changing coordinates so that it actually appears on the map!
119
+ marker.geometry.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
120
+ //adding layer to the map
121
+ this.markersLayer.addFeatures([marker]);
116
122
 
117
- return marker;
118
- };
123
+ return marker;
124
+ };
119
125
 
120
- // clear markers
121
- Gmaps4Rails.clearMarkers = function() {
122
- Gmaps4Rails.clearMarkersLayerIfExists();
123
- Gmaps4Rails.markersLayer = null;
124
- Gmaps4Rails.boundsObject = new OpenLayers.Bounds();
125
- };
126
+ // clear markers
127
+ this.clearMarkers = function() {
128
+ this.clearMarkersLayerIfExists();
129
+ this.markersLayer = null;
130
+ this.boundsObject = new OpenLayers.Bounds();
131
+ };
126
132
 
127
- Gmaps4Rails.clearMarkersLayerIfExists = function() {
128
- if (Gmaps4Rails.markersLayer !== null) {
129
- if (Gmaps4Rails.map.getLayer(Gmaps4Rails.markersLayer.id) !== null) {
130
- Gmaps4Rails.map.removeLayer(Gmaps4Rails.markersLayer);
133
+ this.clearMarkersLayerIfExists = function() {
134
+ if (this.markersLayer !== null) {
135
+ if (this.map.getLayer(this.markersLayer.id) !== null) {
136
+ this.map.removeLayer(this.markersLayer);
137
+ }
131
138
  }
132
- }
133
- };
139
+ };
134
140
 
135
- Gmaps4Rails.extendBoundsWithMarkers = function(){
136
- for (var i = 0; i < this.markers.length; ++i) {
137
- Gmaps4Rails.boundsObject.extend(Gmaps4Rails.createLatLng(Gmaps4Rails.markers[i].lat,Gmaps4Rails.markers[i].lng));
138
- }
139
- };
140
- ////////////////////////////////////////////////////
141
- /////////////////// Clusterer //////////////////////
142
- ////////////////////////////////////////////////////
143
- //too ugly to be considered valid :(
141
+ this.extendBoundsWithMarkers = function(){
142
+ for (var i = 0; i < this.markers.length; ++i) {
143
+ this.boundsObject.extend(this.createLatLng(this.markers[i].lat,this.markers[i].lng));
144
+ }
145
+ };
146
+ ////////////////////////////////////////////////////
147
+ /////////////////// Clusterer //////////////////////
148
+ ////////////////////////////////////////////////////
149
+ //too ugly to be considered valid :(
144
150
 
145
- Gmaps4Rails.createClusterer = function(markers_array){
151
+ this.createClusterer = function(markers_array){
146
152
 
147
- var style = new OpenLayers.Style({
148
- pointRadius: "${radius}",
149
- fillColor: "#ffcc66",
150
- fillOpacity: 0.8,
151
- strokeColor: "#cc6633",
152
- strokeWidth: "${width}",
153
- strokeOpacity: 0.8
154
- }, {
155
- context: {
156
- width: function(feature) {
157
- return (feature.cluster) ? 2 : 1;
158
- },
159
- radius: function(feature) {
160
- var pix = 2;
161
- if(feature.cluster) {
162
- pix = Math.min(feature.attributes.count, 7) + 2;
163
- }
164
- return pix;
165
- }
166
- }
167
- });
153
+ var style = new OpenLayers.Style({
154
+ pointRadius: "${radius}",
155
+ fillColor: "#ffcc66",
156
+ fillOpacity: 0.8,
157
+ strokeColor: "#cc6633",
158
+ strokeWidth: "${width}",
159
+ strokeOpacity: 0.8
160
+ }, {
161
+ context: {
162
+ width: function(feature) {
163
+ return (feature.cluster) ? 2 : 1;
164
+ },
165
+ radius: function(feature) {
166
+ var pix = 2;
167
+ if(feature.cluster) {
168
+ pix = Math.min(feature.attributes.count, 7) + 2;
169
+ }
170
+ return pix;
171
+ }
172
+ }
173
+ });
168
174
 
169
- var strategy = new OpenLayers.Strategy.Cluster();
175
+ var strategy = new OpenLayers.Strategy.Cluster();
170
176
 
171
- var clusters = new OpenLayers.Layer.Vector("Clusters", {
172
- strategies: [strategy],
173
- styleMap: new OpenLayers.StyleMap({
174
- "default": style,
175
- "select": {
176
- fillColor: "#8aeeef",
177
- strokeColor: "#32a8a9"
178
- }
179
- })
180
- });
181
- Gmaps4Rails.clearMarkersLayerIfExists();
182
- Gmaps4Rails.map.addLayer(clusters);
183
- clusters.addFeatures(markers_array);
184
- return clusters;
185
- };
177
+ var clusters = new OpenLayers.Layer.Vector("Clusters", {
178
+ strategies: [strategy],
179
+ styleMap: new OpenLayers.StyleMap({
180
+ "default": style,
181
+ "select": {
182
+ fillColor: "#8aeeef",
183
+ strokeColor: "#32a8a9"
184
+ }
185
+ })
186
+ });
187
+ this.clearMarkersLayerIfExists();
188
+ this.map.addLayer(clusters);
189
+ clusters.addFeatures(markers_array);
190
+ return clusters;
191
+ };
186
192
 
187
- Gmaps4Rails.clusterize = function() {
193
+ this.clusterize = function() {
188
194
 
189
- if (this.markers_conf.do_clustering === true)
190
- {
191
- //first clear the existing clusterer if any
192
- if (this.markerClusterer !== null) {
193
- this.clearClusterer();
194
- }
195
+ if (this.markers_conf.do_clustering === true)
196
+ {
197
+ //first clear the existing clusterer if any
198
+ if (this.markerClusterer !== null) {
199
+ this.clearClusterer();
200
+ }
195
201
 
196
- var markers_array = new Array;
197
- for (var i = 0; i < this.markers.length; ++i) {
198
- markers_array.push(this.markers[i].serviceObject);
199
- }
202
+ var markers_array = new Array;
203
+ for (var i = 0; i < this.markers.length; ++i) {
204
+ markers_array.push(this.markers[i].serviceObject);
205
+ }
200
206
 
201
- this.markerClusterer = Gmaps4Rails.createClusterer(markers_array);
202
- }
207
+ this.markerClusterer = this.createClusterer(markers_array);
208
+ }
203
209
 
204
- };
210
+ };
205
211
 
206
- Gmaps4Rails.clearClusterer = function() {
207
- Gmaps4Rails.map.removeLayer(Gmaps4Rails.markerClusterer);
208
- };
212
+ this.clearClusterer = function() {
213
+ this.map.removeLayer(this.markerClusterer);
214
+ };
209
215
 
210
- ////////////////////////////////////////////////////
211
- /////////////////// INFO WINDOW ////////////////////
212
- ////////////////////////////////////////////////////
216
+ ////////////////////////////////////////////////////
217
+ /////////////////// INFO WINDOW ////////////////////
218
+ ////////////////////////////////////////////////////
213
219
 
214
- // creates infowindows
215
- Gmaps4Rails.createInfoWindow = function(marker_container){
216
- var info_window;
217
- if (Gmaps4Rails.exists(marker_container.description)) {
218
- marker_container.serviceObject.infoWindow = marker_container.description;
219
- }
220
- };
220
+ // creates infowindows
221
+ this.createInfoWindow = function(marker_container){
222
+ var info_window;
223
+ if (this.exists(marker_container.description)) {
224
+ marker_container.serviceObject.infoWindow = marker_container.description;
225
+ }
226
+ };
221
227
 
222
- Gmaps4Rails.onPopupClose = function(evt) {
223
- // 'this' is the popup.
224
- Gmaps4Rails.markersControl.unselect(this.feature);
225
- };
228
+ this.onPopupClose = function(evt) {
229
+ // 'this' is the popup.
230
+ this.markersControl.unselect(this.feature);
231
+ };
226
232
 
227
- Gmaps4Rails.onFeatureSelect = function(evt) {
228
- var feature = evt.feature;
229
- var popup = new OpenLayers.Popup.FramedCloud("featurePopup",
230
- feature.geometry.getBounds().getCenterLonLat(),
231
- new OpenLayers.Size(300,200),
232
- feature.infoWindow,
233
- null, true, Gmaps4Rails.onPopupClose);
234
- feature.popup = popup;
235
- popup.feature = feature;
236
- Gmaps4Rails.map.addPopup(popup);
237
- };
233
+ this.onFeatureSelect = function(evt) {
234
+ var feature = evt.feature;
235
+ var popup = new OpenLayers.Popup.FramedCloud("featurePopup",
236
+ feature.geometry.getBounds().getCenterLonLat(),
237
+ new OpenLayers.Size(300,200),
238
+ feature.infoWindow,
239
+ null, true, this.onPopupClose);
240
+ feature.popup = popup;
241
+ popup.feature = feature;
242
+ this.map.addPopup(popup);
243
+ };
238
244
 
239
- Gmaps4Rails.onFeatureUnselect = function(evt) {
240
- var feature = evt.feature;
241
- if (feature.popup) {
242
- //popup.feature = null;
243
- Gmaps4Rails.map.removePopup(feature.popup);
244
- feature.popup.destroy();
245
- feature.popup = null;
246
- }
247
- };
245
+ this.onFeatureUnselect = function(evt) {
246
+ var feature = evt.feature;
247
+ if (feature.popup) {
248
+ //popup.feature = null;
249
+ this.map.removePopup(feature.popup);
250
+ feature.popup.destroy();
251
+ feature.popup = null;
252
+ }
253
+ };
254
+
255
+ ////////////////////////////////////////////////////
256
+ /////////////////// Other methods //////////////////
257
+ ////////////////////////////////////////////////////
248
258
 
249
- ////////////////////////////////////////////////////
250
- /////////////////// Other methods //////////////////
251
- ////////////////////////////////////////////////////
259
+ this.fitBounds = function(){
260
+ this.map.zoomToExtent(this.boundsObject, true);
261
+ };
252
262
 
253
- Gmaps4Rails.fitBounds = function(){
254
- Gmaps4Rails.map.zoomToExtent(Gmaps4Rails.boundsObject, true);
263
+ this.centerMapOnUser = function(){
264
+ this.map.setCenter(this.userLocation);
265
+ };
255
266
  };
256
267
 
257
- Gmaps4Rails.centerMapOnUser = function(){
258
- Gmaps4Rails.map.setCenter(Gmaps4Rails.userLocation);
259
- };
268
+ Gmaps4RailsOpenlayers.prototype = new Gmaps4Rails();
@@ -1,4 +1,4 @@
1
- #map_container {
1
+ .map_container {
2
2
  padding: 6px;
3
3
  border-width: 1px;
4
4
  border-style: solid;
@@ -9,7 +9,7 @@
9
9
  width: 800px;
10
10
  }
11
11
 
12
- #gmaps4rails_map {
12
+ .gmaps4rails_map {
13
13
  width: 800px;
14
14
  height: 400px;
15
15
  }