gmaps4rails 1.5.5 → 1.5.6

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/.gitignore CHANGED
@@ -6,7 +6,7 @@
6
6
  .DS_Store
7
7
  test/dummy/tmp/**/*
8
8
  test/dummy/log/**/*
9
- test/dummy/.rvmrc
10
9
  pkg
11
10
  .idea
12
- .redcar
11
+ .redcar
12
+ .rvmrc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gmaps4rails (1.5.5)
4
+ gmaps4rails (1.5.6)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -91,7 +91,14 @@ GEM
91
91
  treetop (~> 1.4.8)
92
92
  method_source (0.7.1)
93
93
  mime-types (1.18)
94
+ mongoid (3.0.6)
95
+ activemodel (~> 3.1)
96
+ moped (~> 1.1)
97
+ origin (~> 1.0)
98
+ tzinfo (~> 0.3.22)
99
+ moped (1.2.5)
94
100
  multi_json (1.2.0)
101
+ origin (1.0.9)
95
102
  polyglot (0.3.3)
96
103
  pry (0.9.8.4)
97
104
  coderay (~> 1.0.5)
@@ -172,6 +179,7 @@ DEPENDENCIES
172
179
  guard-spork
173
180
  jasmine
174
181
  jquery-rails
182
+ mongoid (~> 3)
175
183
  pry
176
184
  rails (~> 3.2.1)
177
185
  rspec-rails
@@ -24,6 +24,7 @@ class @Gmaps4Rails
24
24
  @userLocation = null #contains user's location if geolocalization was performed and successful
25
25
 
26
26
  #empty slots
27
+ @geolocationSuccess = -> false #triggered when geolocation succeeds. Can be customized.
27
28
  @geolocationFailure = -> false #triggered when geolocation fails. If customized, must be like= function(navigator_handles_geolocation){} where 'navigator_handles_geolocation' is a boolean
28
29
  @callback = -> false #to let user set a custom callback function
29
30
  @customClusterer = -> false #to let user set custom clusterer pictures
@@ -95,6 +96,7 @@ class @Gmaps4Rails
95
96
  #change map's center to focus on user's geoloc if asked
96
97
  if(map_object.map_options.center_on_user == true)
97
98
  map_object.centerMapOnUser()
99
+ map_object.geolocationSuccess()
98
100
  positionFailure = ->
99
101
  map_object.geolocationFailure(true)
100
102
 
@@ -296,25 +298,25 @@ class @Gmaps4Rails
296
298
 
297
299
 
298
300
  #replace old markers with new markers on an existing map
299
- replaceMarkers : (new_markers) ->
301
+ replaceMarkers : (new_markers, adjustBounds = true) ->
300
302
  @clearMarkers()
301
303
  #reset previous markers
302
304
  @markers = new Array
303
305
  #reset current bounds
304
- @boundsObject = @createLatLngBounds()
306
+ @boundsObject = @createLatLngBounds() if adjustBounds
305
307
  #reset sidebar content if exists
306
308
  @resetSidebarContent()
307
309
  #add new markers
308
310
  @markers_conf.offset = 0
309
- @addMarkers(new_markers)
311
+ @addMarkers(new_markers, adjustBounds)
310
312
 
311
313
  #add new markers to on an existing map
312
- addMarkers : (new_markers) ->
314
+ addMarkers : (new_markers, adjustBounds = true) ->
313
315
  #update the list of markers to take into account
314
316
  @markers = @markers.concat(new_markers)
315
317
  #put markers on the map
316
318
  @create_markers()
317
- @adjustMapToBounds()
319
+ @adjustMapToBounds() if adjustBounds
318
320
 
319
321
  #////////////////////////////////////////////////////
320
322
  #///////////////////// SIDEBAR //////////////////////
@@ -89,7 +89,7 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
89
89
  style_mark.backgroundXOffset = args.shadow_anchor[0]
90
90
  style_mark.backgroundYOffset = args.shadow_anchor[1]
91
91
 
92
- style_mark.graphicTitle = args.title
92
+ style_mark.graphicTitle = args.marker_title
93
93
  marker = new OpenLayers.Feature.Vector(
94
94
  new OpenLayers.Geometry.Point(args.Lng, args.Lat),
95
95
  null,
@@ -1,3 +1,3 @@
1
1
  module Gmaps4rails
2
- VERSION = "1.5.5"
2
+ VERSION = "1.5.6"
3
3
  end
@@ -66,9 +66,9 @@ module Gmaps4rails
66
66
  when "mapquest" then @js_array << "#{MAPQUEST}?key=#{provider_key}"
67
67
  when "bing" then @js_array << BING
68
68
  else #case googlemaps which is the default
69
- @js_array << "#{GOOGLE}&sensor=false&key=#{provider_key}&libraries=geometry#{google_libraries}&#{google_map_i18n}"
69
+ @js_array << "#{GOOGLE}&sensor=false&client=#{client}&key=#{provider_key}&libraries=geometry#{google_libraries}&#{google_map_i18n}"
70
70
  @js_array << "#{GOOGLE_EXT}tags/infobox/1.1.9/src/infobox_packed.js" if custom_infowindow_class
71
- @js_array << "#{GOOGLE_EXT}tags/markerclustererplus/2.0.9/src/markerclusterer_packed.js" if do_clustering
71
+ @js_array << "#{GOOGLE_EXT}tags/markerclustererplus/2.0.14/src/markerclusterer_packed.js" if do_clustering
72
72
  @js_array << "#{GOOGLE_EXT}trunk/richmarker/src/richmarker-compiled.js" if rich_marker
73
73
  end
74
74
  end
@@ -111,6 +111,10 @@ module Gmaps4rails
111
111
  def provider_key
112
112
  map_options.try(:[], :provider_key)
113
113
  end
114
+
115
+ def client
116
+ map_options.try(:[], :client)
117
+ end
114
118
 
115
119
  # when custom_infowindow_class is added in the marker_options,
116
120
  #it means user wants to use the InfoBox googlemap's plugin
@@ -168,4 +172,4 @@ module Gmaps4rails
168
172
 
169
173
  end
170
174
 
171
- end
175
+ end
@@ -9,7 +9,7 @@ class UsersController < ApplicationController
9
9
  @json = @users.to_gmaps4rails do |user, marker|
10
10
  marker.json({:id => user.id })
11
11
  marker.picture({
12
- "picture" => "/logo.png",
12
+ "picture" => "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=A|FF0000|000000",
13
13
  "width" => 32,
14
14
  "height" => 32})
15
15
  marker.infowindow user.name
@@ -0,0 +1,5 @@
1
+ <%#= gmaps(:markers => {:data => json, :options => {:do_clustering => false, "custom_infowindow_class" => "yellow"}},
2
+ :map_options => {:auto_adjust => true, :raw => "{styles: styles}" },
3
+ :last_map => true) %>
4
+
5
+ <%= gmaps4rails json %>
@@ -85,10 +85,10 @@
85
85
  :options => {"list_container" => "markers_list" }
86
86
  })%>
87
87
  <div id="markers_list"></div>
88
- <%#= gmaps(:map_options => { :auto_adjust => true },
89
- :markers => { :data => '[{"lat":42.3124,"lng":71.1712}]', :options => {:do_clustering => true} }) %>
90
88
 
91
- <%= gmaps(:markers => {:data => @json, :options => {:do_clustering => false, "custom_infowindow_class" => "yellow", :raw => "{ flat: true, draggable: true}" } },
89
+ <%= render :partial => 'map', :locals => {:json => @json} %>
90
+
91
+ <%#= gmaps(:markers => {:data => @json, :options => {:do_clustering => false, "custom_infowindow_class" => "yellow", :raw => "{ flat: true, draggable: true}" } },
92
92
  :polygons => {:data => '[[
93
93
  {"lng": 5.190262, "lat": 25.774252},
94
94
  {"lng": 7.118292, "lat": 45.466465},
@@ -178,18 +178,26 @@
178
178
  // });
179
179
  // }
180
180
  //
181
- Gmaps.map.callback = function(){
182
- // Create the DIV to hold the control and call the HomeControl() constructor
183
- // passing in this DIV.
184
- // var homeControlDiv = document.createElement('DIV');
185
- // var homeControl = new HomeControl(homeControlDiv, Gmaps.map.map);
186
- //
187
- // homeControlDiv.index = 1;
188
- // Gmaps.map.map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
189
- //Gmaps.map.serviceObject.setZoom(1);
190
- };
181
+ // Gmaps.map.callback = function(){
182
+ // // Create the DIV to hold the control and call the HomeControl() constructor
183
+ // // passing in this DIV.
184
+ // // var homeControlDiv = document.createElement('DIV');
185
+ // // var homeControl = new HomeControl(homeControlDiv, Gmaps.map.map);
186
+ // //
187
+ // // homeControlDiv.index = 1;
188
+ // // Gmaps.map.map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
189
+ // //Gmaps.map.serviceObject.setZoom(1);
190
+ // };
191
191
  //
192
192
  //
193
+ var styles = [
194
+ {
195
+ featureType: "all",
196
+ stylers: [
197
+ { "hue": "#ff1a00" }
198
+ ]
199
+ }
200
+ ];
193
201
  var pinkParksStyles = [
194
202
  {
195
203
  featureType: "all",
@@ -25,7 +25,7 @@ if RUBY_VERSION == "1.9.3"
25
25
 
26
26
  context "standard configuration, valid place" do
27
27
  it "should save longitude and latitude to the customized position array" do
28
- set_gmaps4rails_options!(:position => 'location')
28
+ set_gmaps4rails_options!(:position => 'pos')
29
29
  place.pos.should_not be_nil
30
30
  place.should have_same_position_as TOULON
31
31
  end
@@ -2,13 +2,15 @@ require 'spec_helper'
2
2
 
3
3
  include Geocoding
4
4
 
5
- set_gmaps4rails_options!
6
-
7
5
  describe Gmaps4rails::ActsAsGmappable do
8
6
 
9
7
  let(:user) { Factory(:user) }
10
8
  let(:invalid_user) { FactoryGirl.build(:invalid_user) }
11
9
 
10
+ before(:all) do
11
+ set_gmaps4rails_options!
12
+ end
13
+
12
14
  before(:each) do
13
15
  Geocoding.stub_geocoding
14
16
  end
@@ -10,7 +10,8 @@ module Geocoding
10
10
  :address => "address",
11
11
  :language => "en",
12
12
  :protocol => "http",
13
- :process_geocoding => true
13
+ :process_geocoding => true,
14
+ :position => nil
14
15
  }
15
16
 
16
17
  PARIS = { :latitude => 48.856614, :longitude => 2.3522219 }
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.5
4
+ version: 1.5.6
5
5
  prerelease:
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-08-07 00:00:00.000000000 Z
13
+ date: 2012-10-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -44,6 +44,22 @@ dependencies:
44
44
  - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: mongoid
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3'
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: '3'
47
63
  - !ruby/object:Gem::Dependency
48
64
  name: jquery-rails
49
65
  requirement: !ruby/object:Gem::Requirement
@@ -301,6 +317,7 @@ files:
301
317
  - spec/dummy/app/models/user.rb
302
318
  - spec/dummy/app/views/layouts/application.html.erb
303
319
  - spec/dummy/app/views/users/_form.html.erb
320
+ - spec/dummy/app/views/users/_map.html.erb
304
321
  - spec/dummy/app/views/users/edit.html.erb
305
322
  - spec/dummy/app/views/users/index.html.erb
306
323
  - spec/dummy/app/views/users/new.html.erb
@@ -377,7 +394,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
377
394
  version: '0'
378
395
  segments:
379
396
  - 0
380
- hash: 371063818464557253
397
+ hash: 412283854871812775
381
398
  required_rubygems_version: !ruby/object:Gem::Requirement
382
399
  none: false
383
400
  requirements:
@@ -386,7 +403,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
386
403
  version: '0'
387
404
  segments:
388
405
  - 0
389
- hash: 371063818464557253
406
+ hash: 412283854871812775
390
407
  requirements: []
391
408
  rubyforge_project:
392
409
  rubygems_version: 1.8.24
@@ -410,6 +427,7 @@ test_files:
410
427
  - spec/dummy/app/models/user.rb
411
428
  - spec/dummy/app/views/layouts/application.html.erb
412
429
  - spec/dummy/app/views/users/_form.html.erb
430
+ - spec/dummy/app/views/users/_map.html.erb
413
431
  - spec/dummy/app/views/users/edit.html.erb
414
432
  - spec/dummy/app/views/users/index.html.erb
415
433
  - spec/dummy/app/views/users/new.html.erb