gmaps4rails 2.0.0.pre → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. data/.travis.yml +2 -4
  2. data/Gemfile +5 -1
  3. data/Gemfile.lock +31 -113
  4. data/README.rdoc +53 -70
  5. data/Rakefile +21 -1
  6. data/gmaps4rails.gemspec +4 -19
  7. data/js_compilation/gmaps_google.js +961 -0
  8. data/lib/generators/gmaps4rails/copy_coffee_generator.rb +14 -0
  9. data/lib/generators/gmaps4rails/copy_js_generator.rb +15 -0
  10. data/lib/gmaps4rails.rb +12 -22
  11. data/lib/gmaps4rails/markers_builder.rb +74 -0
  12. data/lib/gmaps4rails/rails/engine.rb +6 -0
  13. data/lib/gmaps4rails/rails/railtie.rb +6 -0
  14. data/lib/gmaps4rails/version.rb +2 -2
  15. data/script/compile_coffee_files.rb +19 -0
  16. data/script/gmaps4rails.rake +7 -0
  17. data/spec/javascripts/google/builders/marker_spec.js +96 -0
  18. data/spec/javascripts/helpers/SpecHelper.js +101 -0
  19. data/spec/javascripts/helpers/matchers.js +12 -0
  20. data/spec/javascripts/helpers/underscore.js +6 -0
  21. data/spec/javascripts/objects/handler_spec.js +320 -0
  22. data/spec/javascripts/support/jasmine.yml +86 -0
  23. data/spec/javascripts/support/jasmine_helper.rb +11 -0
  24. data/spec/lib/base_spec.rb +10 -52
  25. data/spec/lib/markers_builder_spec.rb +49 -0
  26. data/spec/spec_helper.rb +1 -25
  27. data/vendor/assets/javascripts/gmaps/base.coffee +16 -0
  28. data/vendor/assets/javascripts/gmaps/base/base.coffee +17 -0
  29. data/vendor/assets/javascripts/gmaps/google.coffee +3 -0
  30. data/vendor/assets/javascripts/gmaps/google/builders/bound.coffee +6 -0
  31. data/vendor/assets/javascripts/gmaps/google/builders/circle.coffee +21 -0
  32. data/vendor/assets/javascripts/gmaps/google/builders/clusterer.coffee +6 -0
  33. data/vendor/assets/javascripts/gmaps/google/builders/kml.coffee +17 -0
  34. data/vendor/assets/javascripts/gmaps/google/builders/map.coffee +27 -0
  35. data/vendor/assets/javascripts/gmaps/google/builders/marker.coffee +100 -0
  36. data/vendor/assets/javascripts/gmaps/google/builders/polygon.coffee +24 -0
  37. data/vendor/assets/javascripts/gmaps/google/builders/polyline.coffee +24 -0
  38. data/vendor/assets/javascripts/gmaps/google/objects/bound.coffee +13 -0
  39. data/vendor/assets/javascripts/gmaps/google/objects/circle.coffee +9 -0
  40. data/vendor/assets/javascripts/gmaps/google/objects/clusterer.coffee +13 -0
  41. data/vendor/assets/javascripts/gmaps/google/objects/common.coffee +23 -0
  42. data/vendor/assets/javascripts/gmaps/google/objects/kml.coffee +15 -0
  43. data/vendor/assets/javascripts/gmaps/google/objects/map.coffee +19 -0
  44. data/vendor/assets/javascripts/gmaps/google/objects/marker.coffee +11 -0
  45. data/vendor/assets/javascripts/gmaps/google/objects/polygon.coffee +8 -0
  46. data/vendor/assets/javascripts/gmaps/google/objects/polyline.coffee +8 -0
  47. data/vendor/assets/javascripts/gmaps/google/primitives.coffee +43 -0
  48. data/vendor/assets/javascripts/gmaps/objects/base_builder.coffee +20 -0
  49. data/vendor/assets/javascripts/gmaps/objects/builder.coffee +12 -0
  50. data/vendor/assets/javascripts/gmaps/objects/handler.coffee +153 -0
  51. data/vendor/assets/javascripts/gmaps/objects/null_clusterer.coffee +4 -0
  52. metadata +66 -299
  53. data/Guardfile.old +0 -24
  54. data/app/views/gmaps4rails/_gmaps4rails.html.erb +0 -20
  55. data/lib/generators/gmaps4rails/install_generator.rb +0 -43
  56. data/lib/generators/templates/README +0 -2
  57. data/lib/gmaps4rails/acts_as_gmappable.rb +0 -54
  58. data/lib/gmaps4rails/api_wrappers/base_net_methods.rb +0 -40
  59. data/lib/gmaps4rails/api_wrappers/direction.rb +0 -87
  60. data/lib/gmaps4rails/api_wrappers/geocoder.rb +0 -54
  61. data/lib/gmaps4rails/api_wrappers/places.rb +0 -74
  62. data/lib/gmaps4rails/base.rb +0 -126
  63. data/lib/gmaps4rails/extensions/enumerable.rb +0 -14
  64. data/lib/gmaps4rails/extensions/hash.rb +0 -9
  65. data/lib/gmaps4rails/helper/gmaps4rails_helper.rb +0 -33
  66. data/lib/gmaps4rails/js_builder.rb +0 -154
  67. data/lib/gmaps4rails/json_builder.rb +0 -140
  68. data/lib/gmaps4rails/model_handler.rb +0 -101
  69. data/lib/gmaps4rails/view_helper.rb +0 -172
  70. data/lib/tasks/jasmine.rake +0 -8
  71. data/public/javascripts/gmaps4rails/all.js +0 -2144
  72. data/public/javascripts/gmaps4rails/base.js +0 -792
  73. data/public/javascripts/gmaps4rails/google.js +0 -556
  74. data/public/javascripts/gmaps4rails/openlayers.js +0 -377
  75. data/public/stylesheets/gmaps4rails.css +0 -24
  76. data/spec/dummy/.gitignore +0 -3
  77. data/spec/dummy/.rspec +0 -1
  78. data/spec/dummy/README.rdoc +0 -261
  79. data/spec/dummy/Rakefile +0 -7
  80. data/spec/dummy/app/assets/javascripts/application.js +0 -18
  81. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  82. data/spec/dummy/app/assets/stylesheets/gmaps4rails.css +0 -24
  83. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  84. data/spec/dummy/app/controllers/users_controller.rb +0 -105
  85. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  86. data/spec/dummy/app/mailers/.gitkeep +0 -0
  87. data/spec/dummy/app/models/.gitkeep +0 -0
  88. data/spec/dummy/app/models/place.rb +0 -16
  89. data/spec/dummy/app/models/user.rb +0 -12
  90. data/spec/dummy/app/views/layouts/application.html.erb +0 -17
  91. data/spec/dummy/app/views/users/_form.html.erb +0 -37
  92. data/spec/dummy/app/views/users/edit.html.erb +0 -6
  93. data/spec/dummy/app/views/users/index.html.erb +0 -268
  94. data/spec/dummy/app/views/users/new.html.erb +0 -5
  95. data/spec/dummy/app/views/users/show.html.erb +0 -30
  96. data/spec/dummy/config.ru +0 -4
  97. data/spec/dummy/config/application.rb +0 -62
  98. data/spec/dummy/config/boot.rb +0 -10
  99. data/spec/dummy/config/database.yml +0 -25
  100. data/spec/dummy/config/environment.rb +0 -5
  101. data/spec/dummy/config/environments/development.rb +0 -37
  102. data/spec/dummy/config/environments/production.rb +0 -67
  103. data/spec/dummy/config/environments/test.rb +0 -37
  104. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  105. data/spec/dummy/config/initializers/gmaps4rails.rb +0 -1
  106. data/spec/dummy/config/initializers/inflections.rb +0 -15
  107. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  108. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  109. data/spec/dummy/config/initializers/session_store.rb +0 -8
  110. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  111. data/spec/dummy/config/locales/en.yml +0 -5
  112. data/spec/dummy/config/routes.rb +0 -60
  113. data/spec/dummy/db/migrate/20120408170155_create_users.rb +0 -16
  114. data/spec/dummy/db/schema.rb +0 -29
  115. data/spec/dummy/lib/assets/.gitkeep +0 -0
  116. data/spec/dummy/log/.gitkeep +0 -0
  117. data/spec/dummy/public/404.html +0 -26
  118. data/spec/dummy/public/422.html +0 -26
  119. data/spec/dummy/public/500.html +0 -25
  120. data/spec/dummy/public/favicon.ico +0 -0
  121. data/spec/dummy/public/javascripts/Player.js +0 -22
  122. data/spec/dummy/public/javascripts/Song.js +0 -7
  123. data/spec/dummy/public/logo.png +0 -0
  124. data/spec/dummy/script/rails +0 -6
  125. data/spec/factories/place_factory.rb +0 -16
  126. data/spec/factories/user_factory.rb +0 -23
  127. data/spec/fixtures/google_direction_valid.json +0 -65
  128. data/spec/fixtures/google_geocoding_toulon_france.json +0 -58
  129. data/spec/fixtures/google_places_valid.json +0 -45
  130. data/spec/fixtures/google_wrong_geocoding.json +0 -4
  131. data/spec/launchers/all_but_requests.rb +0 -0
  132. data/spec/launchers/all_specs.rb +0 -0
  133. data/spec/launchers/requests.rb +0 -0
  134. data/spec/lib/direction_spec.rb +0 -53
  135. data/spec/lib/geocoder_spec.rb +0 -46
  136. data/spec/lib/js_builder_spec.rb +0 -134
  137. data/spec/lib/json_builder_spec.rb +0 -232
  138. data/spec/lib/places_spec.rb +0 -25
  139. data/spec/models/place_spec.rb +0 -39
  140. data/spec/models/user_spec.rb +0 -187
  141. data/spec/support/geocoding.rb +0 -40
  142. data/spec/support/matchers.rb +0 -73
  143. data/todo +0 -0
  144. data/vendor/assets/javascripts/gmaps4rails/all.js +0 -1
  145. data/vendor/assets/javascripts/gmaps4rails/base.coffee +0 -1
  146. data/vendor/assets/javascripts/gmaps4rails/base/common.coffee +0 -43
  147. data/vendor/assets/javascripts/gmaps4rails/base/configuration.coffee +0 -7
  148. data/vendor/assets/javascripts/gmaps4rails/base/gmaps.coffee +0 -13
  149. data/vendor/assets/javascripts/gmaps4rails/base/interfaces/basic_interface.coffee +0 -15
  150. data/vendor/assets/javascripts/gmaps4rails/base/interfaces/controller_interface.coffee +0 -15
  151. data/vendor/assets/javascripts/gmaps4rails/base/interfaces/map_interface.coffee +0 -27
  152. data/vendor/assets/javascripts/gmaps4rails/base/interfaces/marker_interface.coffee +0 -15
  153. data/vendor/assets/javascripts/gmaps4rails/base/main.coffee +0 -124
  154. data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/circle_controller.coffee +0 -29
  155. data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/kml_controller.coffee +0 -5
  156. data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/marker_controller.coffee +0 -76
  157. data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/polygon_controller.coffee +0 -29
  158. data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/polyline_controller.coffee +0 -29
  159. data/vendor/assets/javascripts/gmaps4rails/base/objects/circle.coffee +0 -12
  160. data/vendor/assets/javascripts/gmaps4rails/base/objects/kml.coffee +0 -8
  161. data/vendor/assets/javascripts/gmaps4rails/base/objects/map.coffee +0 -62
  162. data/vendor/assets/javascripts/gmaps4rails/base/objects/marker.coffee +0 -24
  163. data/vendor/assets/javascripts/gmaps4rails/base/objects/polygon.coffee +0 -11
  164. data/vendor/assets/javascripts/gmaps4rails/base/objects/polyline.coffee +0 -11
  165. data/vendor/assets/javascripts/gmaps4rails/bing.coffee +0 -1
  166. data/vendor/assets/javascripts/gmaps4rails/bing/main.coffee +0 -29
  167. data/vendor/assets/javascripts/gmaps4rails/bing/objects/map.coffee +0 -63
  168. data/vendor/assets/javascripts/gmaps4rails/bing/objects/marker.coffee +0 -78
  169. data/vendor/assets/javascripts/gmaps4rails/bing/shared.coffee +0 -20
  170. data/vendor/assets/javascripts/gmaps4rails/google.coffee +0 -1
  171. data/vendor/assets/javascripts/gmaps4rails/google/main.coffee +0 -47
  172. data/vendor/assets/javascripts/gmaps4rails/google/objects/circle.coffee +0 -38
  173. data/vendor/assets/javascripts/gmaps4rails/google/objects/kml.coffee +0 -16
  174. data/vendor/assets/javascripts/gmaps4rails/google/objects/map.coffee +0 -71
  175. data/vendor/assets/javascripts/gmaps4rails/google/objects/marker.coffee +0 -114
  176. data/vendor/assets/javascripts/gmaps4rails/google/objects/polygon.coffee +0 -38
  177. data/vendor/assets/javascripts/gmaps4rails/google/objects/polyline.coffee +0 -49
  178. data/vendor/assets/javascripts/gmaps4rails/google/shared.coffee +0 -27
  179. data/vendor/assets/javascripts/gmaps4rails/openlayers.coffee +0 -1
  180. data/vendor/assets/javascripts/gmaps4rails/openlayers/main.coffee +0 -138
  181. data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/map.coffee +0 -49
  182. data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/marker.coffee +0 -68
  183. data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/polyline.coffee +0 -39
  184. data/vendor/assets/javascripts/gmaps4rails/openlayers/shared.coffee +0 -19
@@ -1,377 +0,0 @@
1
- (function() {
2
-
3
- Gmaps4Rails.Openlayers = {};
4
-
5
- Gmaps4Rails.Openlayers.Shared = {
6
- createPoint: function(lat, lng) {
7
- return new OpenLayers.Geometry.Point(lng, lat);
8
- },
9
- createLatLng: function(lat, lng) {
10
- return new OpenLayers.LonLat(lng, lat).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
11
- },
12
- createAnchor: function(offset) {
13
- if (offset === null) return null;
14
- return new OpenLayers.Pixel(offset[0], offset[1]);
15
- },
16
- createSize: function(width, height) {
17
- return new OpenLayers.Size(width, height);
18
- },
19
- createLatLngBounds: function() {
20
- return new OpenLayers.Bounds();
21
- }
22
- };
23
-
24
- }).call(this);
25
- (function() {
26
- var __hasProp = Object.prototype.hasOwnProperty,
27
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
28
-
29
- this.Gmaps4Rails.Openlayers.Map = (function(_super) {
30
-
31
- __extends(Map, _super);
32
-
33
- Map.include(Gmaps4Rails.Interfaces.Map);
34
-
35
- Map.include(Gmaps4Rails.Map);
36
-
37
- Map.include(Gmaps4Rails.Openlayers.Shared);
38
-
39
- Map.include(Gmaps4Rails.Configuration);
40
-
41
- Map.prototype.CONF = {
42
- disableDefaultUI: false,
43
- disableDoubleClickZoom: false,
44
- type: "ROADMAP",
45
- mapTypeControl: null
46
- };
47
-
48
- function Map(map_options, controller) {
49
- var defaultOptions, mergedOpenlayersOptions, openlayersOptions;
50
- this.controller = controller;
51
- defaultOptions = this.setConf();
52
- this.options = this.mergeObjects(map_options, defaultOptions);
53
- openlayersOptions = {
54
- center: this.createLatLng(this.options.center_latitude, this.options.center_longitude),
55
- zoom: this.options.zoom
56
- };
57
- mergedOpenlayersOptions = this.mergeObjects(map_options.raw, openlayersOptions);
58
- this.serviceObject = new OpenLayers.Map(this.options.id, mergedOpenlayersOptions);
59
- this.serviceObject.addLayer(new OpenLayers.Layer.OSM());
60
- }
61
-
62
- Map.prototype.extendBoundsWithMarker = function(marker) {
63
- return this.boundsObject.extend(this.createLatLng(marker.lat, marker.lng));
64
- };
65
-
66
- Map.prototype.extendBoundsWithPolyline = function(polyline) {};
67
-
68
- Map.prototype.extendBoundsWithPolygon = function(polygon) {};
69
-
70
- Map.prototype.extendBoundsWithCircle = function(circle) {};
71
-
72
- Map.prototype.extendBound = function(bound) {};
73
-
74
- Map.prototype.fitBounds = function() {
75
- return this.serviceObject.zoomToExtent(this.boundsObject, true);
76
- };
77
-
78
- Map.prototype.adaptToBounds = function() {
79
- return this.fitBounds();
80
- };
81
-
82
- Map.prototype.centerMapOnUser = function(position) {
83
- return this.serviceObject.setCenter(position);
84
- };
85
-
86
- return Map;
87
-
88
- })(Gmaps4Rails.Common);
89
-
90
- }).call(this);
91
- (function() {
92
- var __hasProp = Object.prototype.hasOwnProperty,
93
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
94
-
95
- this.Gmaps4Rails.Openlayers.Marker = (function(_super) {
96
-
97
- __extends(Marker, _super);
98
-
99
- Marker.include(Gmaps4Rails.Interfaces.Marker);
100
-
101
- Marker.include(Gmaps4Rails.Openlayers.Shared);
102
-
103
- Marker.include(Gmaps4Rails.Marker.Instance);
104
-
105
- Marker.extend(Gmaps4Rails.Marker.Class);
106
-
107
- Marker.extend(Gmaps4Rails.Configuration);
108
-
109
- function Marker(args, controller) {
110
- this.controller = controller;
111
- this.controller._createMarkersLayer();
112
- this._createMarkerStyle(args);
113
- if (this._isBasicMarker(args)) {
114
- this._styleForBasicMarker(args);
115
- } else {
116
- this._styleForCustomMarker(args);
117
- }
118
- this.serviceObject = new OpenLayers.Feature.Vector(this.createPoint(args.lat, args.lng), null, this.style_mark);
119
- this.serviceObject.geometry.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
120
- this.controller.markersLayer.addFeatures([this.serviceObject]);
121
- }
122
-
123
- Marker.prototype.createInfoWindow = function() {
124
- if (this.description != null) {
125
- return this.serviceObject.infoWindow = this.description;
126
- }
127
- };
128
-
129
- Marker.prototype.isVisible = function() {
130
- return true;
131
- };
132
-
133
- Marker.prototype._isBasicMarker = function(args) {
134
- return !(args.marker_picture != null);
135
- };
136
-
137
- Marker.prototype._createMarkerStyle = function(args) {
138
- this.style_mark = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
139
- this.style_mark.fillOpacity = 1;
140
- return this.style_mark.graphicTitle = args.title;
141
- };
142
-
143
- Marker.prototype._styleForBasicMarker = function(args) {
144
- this.style_mark.graphicHeight = 30;
145
- return this.style_mark.externalGraphic = "http://openlayers.org/dev/img/marker-blue.png";
146
- };
147
-
148
- Marker.prototype._styleForCustomMarker = function(args) {
149
- this.style_mark.graphicWidth = args.marker_width;
150
- this.style_mark.graphicHeight = args.marker_height;
151
- this.style_mark.externalGraphic = args.marker_picture;
152
- if (args.marker_anchor != null) {
153
- this.style_mark.graphicXOffset = args.marker_anchor[0];
154
- this.style_mark.graphicYOffset = args.marker_anchor[1];
155
- }
156
- if (args.shadow_picture != null) {
157
- this.style_mark.backgroundGraphic = args.shadow_picture;
158
- this.style_mark.backgroundWidth = args.shadow_width;
159
- this.style_mark.backgroundHeight = args.shadow_height;
160
- if (args.shadow_anchor != null) {
161
- this.style_mark.backgroundXOffset = args.shadow_anchor[0];
162
- return this.style_mark.backgroundYOffset = args.shadow_anchor[1];
163
- }
164
- }
165
- };
166
-
167
- return Marker;
168
-
169
- })(Gmaps4Rails.Common);
170
-
171
- }).call(this);
172
- (function() {
173
- var __hasProp = Object.prototype.hasOwnProperty,
174
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
175
-
176
- this.Gmaps4Rails.Openlayers.Polyline = (function(_super) {
177
-
178
- __extends(Polyline, _super);
179
-
180
- Polyline.include(Gmaps4Rails.Openlayers.Shared);
181
-
182
- Polyline.extend(Gmaps4Rails.Polyline.Class);
183
-
184
- Polyline.extend(Gmaps4Rails.Configuration);
185
-
186
- function Polyline(polyline, controller) {
187
- var clickable, element, latlng, line_points, line_style, polyline_coordinates, strokeColor, strokeOpacity, strokeWeight, zIndex, _i, _len;
188
- this.controller = controller;
189
- this.controller._createPolylinesLayer();
190
- polyline_coordinates = [];
191
- for (_i = 0, _len = polyline.length; _i < _len; _i++) {
192
- element = polyline[_i];
193
- if (element === polyline[0]) {
194
- strokeColor = element.strokeColor || this.controller.polylines_conf.strokeColor;
195
- strokeOpacity = element.strokeOpacity || this.controller.polylines_conf.strokeOpacity;
196
- strokeWeight = element.strokeWeight || this.controller.polylines_conf.strokeWeight;
197
- clickable = element.clickable || this.controller.polylines_conf.clickable;
198
- zIndex = element.zIndex || this.controller.polylines_conf.zIndex;
199
- }
200
- if ((element.lat != null) && (element.lng != null)) {
201
- latlng = new OpenLayers.Geometry.Point(element.lng, element.lat);
202
- polyline_coordinates.push(latlng);
203
- }
204
- }
205
- line_points = new OpenLayers.Geometry.LineString(polyline_coordinates);
206
- line_style = {
207
- strokeColor: strokeColor,
208
- strokeOpacity: strokeOpacity,
209
- strokeWidth: strokeWeight
210
- };
211
- this.serviceObject = new OpenLayers.Feature.Vector(line_points, null, line_style);
212
- this.serviceObject.geometry.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
213
- this.controller.polylinesLayer.addFeatures([this.serviceObject]);
214
- }
215
-
216
- Polyline.prototype.isVisible = function() {
217
- return true;
218
- };
219
-
220
- return Polyline;
221
-
222
- })(Gmaps4Rails.Common);
223
-
224
- }).call(this);
225
- (function() {
226
- var __hasProp = Object.prototype.hasOwnProperty,
227
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
228
-
229
- this.Gmaps4RailsOpenlayers = (function(_super) {
230
-
231
- __extends(Gmaps4RailsOpenlayers, _super);
232
-
233
- Gmaps4RailsOpenlayers.include(Gmaps4Rails.Openlayers.Shared);
234
-
235
- function Gmaps4RailsOpenlayers() {
236
- Gmaps4RailsOpenlayers.__super__.constructor.apply(this, arguments);
237
- this.markersControl = null;
238
- this.markersLayer = null;
239
- this.polylinesLayer = null;
240
- }
241
-
242
- Gmaps4RailsOpenlayers.prototype.getModule = function() {
243
- return Gmaps4Rails.Openlayers;
244
- };
245
-
246
- Gmaps4RailsOpenlayers.prototype.createClusterer = function(marker_serviceObject_array) {
247
- var strategy, style;
248
- style = new OpenLayers.Style(this._clustererOptions, this._clustererFunctions);
249
- strategy = new OpenLayers.Strategy.Cluster;
250
- this._clearMarkersLayer();
251
- this.clusterLayer = new OpenLayers.Layer.Vector("Clusters", {
252
- strategies: [strategy],
253
- styleMap: new OpenLayers.StyleMap({
254
- "default": style,
255
- "select": {
256
- fillColor: "#8aeeef",
257
- strokeColor: "#32a8a9"
258
- }
259
- })
260
- });
261
- this.getMapObject().addLayer(this.clusterLayer);
262
- this.clusterLayer.addFeatures(marker_serviceObject_array);
263
- return this.clusterLayer;
264
- };
265
-
266
- Gmaps4RailsOpenlayers.prototype.clearClusterer = function() {
267
- if ((this.clusterLayer != null) && (this.getMapObject().getLayer(this.clusterLayer.id) != null)) {
268
- this.getMapObject().removeLayer(this.markerClusterer);
269
- }
270
- return this.clusterLayer = null;
271
- };
272
-
273
- Gmaps4RailsOpenlayers.prototype.clearMarkers = function() {
274
- this._clearMarkersLayer();
275
- this.clearClusterer();
276
- return this.markers = [];
277
- };
278
-
279
- Gmaps4RailsOpenlayers.prototype._createPolylinesLayer = function() {
280
- if (this.polylinesLayer != null) return;
281
- this.polylinesLayer = new OpenLayers.Layer.Vector("Polylines", null);
282
- this.polylinesLayer.events.register("featureselected", this.polylinesLayer, this._onFeatureSelect);
283
- this.polylinesLayer.events.register("featureunselected", this.polylinesLayer, this._onFeatureUnselect);
284
- this.polylinesControl = new OpenLayers.Control.DrawFeature(this.polylinesLayer, OpenLayers.Handler.Path);
285
- this.getMapObject().addLayer(this.polylinesLayer);
286
- return this.getMapObject().addControl(this.polylinesControl);
287
- };
288
-
289
- Gmaps4RailsOpenlayers.prototype._createMarkersLayer = function() {
290
- if (this.markersLayer != null) return;
291
- this.markersLayer = new OpenLayers.Layer.Vector("Markers", null);
292
- this.getMapObject().addLayer(this.markersLayer);
293
- this.markersLayer.events.register("featureselected", this.markersLayer, this._onFeatureSelect());
294
- this.markersLayer.events.register("featureunselected", this.markersLayer, this._onFeatureUnselect());
295
- this.markersControl = new OpenLayers.Control.SelectFeature(this.markersLayer);
296
- this.getMapObject().addControl(this.markersControl);
297
- return this.markersControl.activate();
298
- };
299
-
300
- Gmaps4RailsOpenlayers.prototype._clearMarkersLayer = function() {
301
- if ((this.markersLayer != null) && (this.getMapObject().getLayer(this.markersLayer.id) != null)) {
302
- this.getMapObject().removeLayer(this.markersLayer);
303
- }
304
- return this.markersLayer = null;
305
- };
306
-
307
- Gmaps4RailsOpenlayers.prototype._onFeatureSelect = function() {
308
- var controller;
309
- controller = this;
310
- return function(evt) {
311
- var feature, popup;
312
- feature = evt.feature;
313
- popup = new OpenLayers.Popup.FramedCloud("featurePopup", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(300, 200), feature.infoWindow, null, true, controller._onPopupClose(controller, feature));
314
- feature.popup = popup;
315
- popup.feature = feature;
316
- return controller.getMapObject().addPopup(popup);
317
- };
318
- };
319
-
320
- Gmaps4RailsOpenlayers.prototype._onFeatureUnselect = function() {
321
- var controller;
322
- controller = this;
323
- return function(evt) {
324
- var feature;
325
- feature = evt.feature;
326
- if (feature.popup != null) {
327
- controller.getMapObject().removePopup(feature.popup);
328
- feature.popup.destroy();
329
- return feature.popup = null;
330
- }
331
- };
332
- };
333
-
334
- Gmaps4RailsOpenlayers.prototype._onPopupClose = function(controller, feature) {
335
- return function() {
336
- return controller.markersControl.unselect(feature);
337
- };
338
- };
339
-
340
- Gmaps4RailsOpenlayers.prototype._clustererFunctions = {
341
- context: {
342
- width: function(feature) {
343
- var _ref;
344
- return (_ref = feature.cluster) != null ? _ref : {
345
- 2: 1
346
- };
347
- },
348
- radius: function(feature) {
349
- var pix;
350
- pix = 2;
351
- if (feature.cluster) pix = feature.cluster.length + 10;
352
- return pix;
353
- },
354
- label: function(feature) {
355
- if (feature.cluster) {
356
- return feature.cluster.length;
357
- } else {
358
- return "";
359
- }
360
- }
361
- }
362
- };
363
-
364
- Gmaps4RailsOpenlayers.prototype._clustererOptions = {
365
- pointRadius: "${radius}",
366
- fillColor: "#ffcc66",
367
- fillOpacity: 0.8,
368
- strokeColor: "#cc6633",
369
- strokeWidth: "${width}",
370
- label: "${label}"
371
- };
372
-
373
- return Gmaps4RailsOpenlayers;
374
-
375
- })(Gmaps4Rails.BaseController);
376
-
377
- }).call(this);
@@ -1,24 +0,0 @@
1
- .map_container {
2
- padding: 6px;
3
- border-width: 1px;
4
- border-style: solid;
5
- border-color: #ccc #ccc #999 #ccc;
6
- -webkit-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px;
7
- -moz-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px;
8
- box-shadow: rgba(64, 64, 64, 0.1) 0 2px 5px;
9
- width: 800px;
10
- }
11
-
12
- .gmaps4rails_map {
13
- width: 800px;
14
- height: 400px;
15
- }
16
-
17
- .bing_map {
18
- position: absolute;
19
- top: 20;
20
- left: 10;
21
- width: 400px;
22
- height: 400px;
23
- border:#555555 2px solid;
24
- }
@@ -1,3 +0,0 @@
1
- tmp
2
- db/*.sqlite3
3
- config/initializers/api_keys.rb
data/spec/dummy/.rspec DELETED
@@ -1 +0,0 @@
1
- --colour
@@ -1,261 +0,0 @@
1
- == Welcome to Rails
2
-
3
- Rails is a web-application framework that includes everything needed to create
4
- database-backed web applications according to the Model-View-Control pattern.
5
-
6
- This pattern splits the view (also called the presentation) into "dumb"
7
- templates that are primarily responsible for inserting pre-built data in between
8
- HTML tags. The model contains the "smart" domain objects (such as Account,
9
- Product, Person, Post) that holds all the business logic and knows how to
10
- persist themselves to a database. The controller handles the incoming requests
11
- (such as Save New Account, Update Product, Show Post) by manipulating the model
12
- and directing data to the view.
13
-
14
- In Rails, the model is handled by what's called an object-relational mapping
15
- layer entitled Active Record. This layer allows you to present the data from
16
- database rows as objects and embellish these data objects with business logic
17
- methods. You can read more about Active Record in
18
- link:files/vendor/rails/activerecord/README.html.
19
-
20
- The controller and view are handled by the Action Pack, which handles both
21
- layers by its two parts: Action View and Action Controller. These two layers
22
- are bundled in a single package due to their heavy interdependence. This is
23
- unlike the relationship between the Active Record and Action Pack that is much
24
- more separate. Each of these packages can be used independently outside of
25
- Rails. You can read more about Action Pack in
26
- link:files/vendor/rails/actionpack/README.html.
27
-
28
-
29
- == Getting Started
30
-
31
- 1. At the command prompt, create a new Rails application:
32
- <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
-
34
- 2. Change directory to <tt>myapp</tt> and start the web server:
35
- <tt>cd myapp; rails server</tt> (run with --help for options)
36
-
37
- 3. Go to http://localhost:3000/ and you'll see:
38
- "Welcome aboard: You're riding Ruby on Rails!"
39
-
40
- 4. Follow the guidelines to start developing your application. You can find
41
- the following resources handy:
42
-
43
- * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
- * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
-
46
-
47
- == Debugging Rails
48
-
49
- Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
- will help you debug it and get it back on the rails.
51
-
52
- First area to check is the application log files. Have "tail -f" commands
53
- running on the server.log and development.log. Rails will automatically display
54
- debugging and runtime information to these files. Debugging info will also be
55
- shown in the browser on requests from 127.0.0.1.
56
-
57
- You can also log your own messages directly into the log file from your code
58
- using the Ruby logger class from inside your controllers. Example:
59
-
60
- class WeblogController < ActionController::Base
61
- def destroy
62
- @weblog = Weblog.find(params[:id])
63
- @weblog.destroy
64
- logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
- end
66
- end
67
-
68
- The result will be a message in your log file along the lines of:
69
-
70
- Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
-
72
- More information on how to use the logger is at http://www.ruby-doc.org/core/
73
-
74
- Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
- several books available online as well:
76
-
77
- * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
- * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
-
80
- These two books will bring you up to speed on the Ruby language and also on
81
- programming in general.
82
-
83
-
84
- == Debugger
85
-
86
- Debugger support is available through the debugger command when you start your
87
- Mongrel or WEBrick server with --debugger. This means that you can break out of
88
- execution at any point in the code, investigate and change the model, and then,
89
- resume execution! You need to install ruby-debug to run the server in debugging
90
- mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
-
92
- class WeblogController < ActionController::Base
93
- def index
94
- @posts = Post.all
95
- debugger
96
- end
97
- end
98
-
99
- So the controller will accept the action, run the first line, then present you
100
- with a IRB prompt in the server window. Here you can do things like:
101
-
102
- >> @posts.inspect
103
- => "[#<Post:0x14a6be8
104
- @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
- #<Post:0x14a6620
106
- @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
- >> @posts.first.title = "hello from a debugger"
108
- => "hello from a debugger"
109
-
110
- ...and even better, you can examine how your runtime objects actually work:
111
-
112
- >> f = @posts.first
113
- => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
- >> f.
115
- Display all 152 possibilities? (y or n)
116
-
117
- Finally, when you're ready to resume execution, you can enter "cont".
118
-
119
-
120
- == Console
121
-
122
- The console is a Ruby shell, which allows you to interact with your
123
- application's domain model. Here you'll have all parts of the application
124
- configured, just like it is when the application is running. You can inspect
125
- domain models, change values, and save to the database. Starting the script
126
- without arguments will launch it in the development environment.
127
-
128
- To start the console, run <tt>rails console</tt> from the application
129
- directory.
130
-
131
- Options:
132
-
133
- * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
- made to the database.
135
- * Passing an environment name as an argument will load the corresponding
136
- environment. Example: <tt>rails console production</tt>.
137
-
138
- To reload your controllers and models after launching the console run
139
- <tt>reload!</tt>
140
-
141
- More information about irb can be found at:
142
- link:http://www.rubycentral.org/pickaxe/irb.html
143
-
144
-
145
- == dbconsole
146
-
147
- You can go to the command line of your database directly through <tt>rails
148
- dbconsole</tt>. You would be connected to the database with the credentials
149
- defined in database.yml. Starting the script without arguments will connect you
150
- to the development database. Passing an argument will connect you to a different
151
- database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
- PostgreSQL and SQLite 3.
153
-
154
- == Description of Contents
155
-
156
- The default directory structure of a generated Ruby on Rails application:
157
-
158
- |-- app
159
- | |-- assets
160
- | |-- images
161
- | |-- javascripts
162
- | `-- stylesheets
163
- | |-- controllers
164
- | |-- helpers
165
- | |-- mailers
166
- | |-- models
167
- | `-- views
168
- | `-- layouts
169
- |-- config
170
- | |-- environments
171
- | |-- initializers
172
- | `-- locales
173
- |-- db
174
- |-- doc
175
- |-- lib
176
- | `-- tasks
177
- |-- log
178
- |-- public
179
- |-- script
180
- |-- test
181
- | |-- fixtures
182
- | |-- functional
183
- | |-- integration
184
- | |-- performance
185
- | `-- unit
186
- |-- tmp
187
- | |-- cache
188
- | |-- pids
189
- | |-- sessions
190
- | `-- sockets
191
- `-- vendor
192
- |-- assets
193
- `-- stylesheets
194
- `-- plugins
195
-
196
- app
197
- Holds all the code that's specific to this particular application.
198
-
199
- app/assets
200
- Contains subdirectories for images, stylesheets, and JavaScript files.
201
-
202
- app/controllers
203
- Holds controllers that should be named like weblogs_controller.rb for
204
- automated URL mapping. All controllers should descend from
205
- ApplicationController which itself descends from ActionController::Base.
206
-
207
- app/models
208
- Holds models that should be named like post.rb. Models descend from
209
- ActiveRecord::Base by default.
210
-
211
- app/views
212
- Holds the template files for the view that should be named like
213
- weblogs/index.html.erb for the WeblogsController#index action. All views use
214
- eRuby syntax by default.
215
-
216
- app/views/layouts
217
- Holds the template files for layouts to be used with views. This models the
218
- common header/footer method of wrapping views. In your views, define a layout
219
- using the <tt>layout :default</tt> and create a file named default.html.erb.
220
- Inside default.html.erb, call <% yield %> to render the view using this
221
- layout.
222
-
223
- app/helpers
224
- Holds view helpers that should be named like weblogs_helper.rb. These are
225
- generated for you automatically when using generators for controllers.
226
- Helpers can be used to wrap functionality for your views into methods.
227
-
228
- config
229
- Configuration files for the Rails environment, the routing map, the database,
230
- and other dependencies.
231
-
232
- db
233
- Contains the database schema in schema.rb. db/migrate contains all the
234
- sequence of Migrations for your schema.
235
-
236
- doc
237
- This directory is where your application documentation will be stored when
238
- generated using <tt>rake doc:app</tt>
239
-
240
- lib
241
- Application specific libraries. Basically, any kind of custom code that
242
- doesn't belong under controllers, models, or helpers. This directory is in
243
- the load path.
244
-
245
- public
246
- The directory available for the web server. Also contains the dispatchers and the
247
- default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
- server.
249
-
250
- script
251
- Helper scripts for automation and generation.
252
-
253
- test
254
- Unit and functional tests along with fixtures. When using the rails generate
255
- command, template test files will be generated for you and placed in this
256
- directory.
257
-
258
- vendor
259
- External libraries that the application depends on. Also includes the plugins
260
- subdirectory. If the app has frozen rails, those gems also go here, under
261
- vendor/rails/. This directory is in the load path.