bhm-google-maps 0.2.1 → 0.3.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.
- data/bhm-google-maps.gemspec +2 -2
 - data/coffeescripts/gmap.coffee +5 -7
 - data/javascripts/gmap.js +3 -4
 - data/lib/bhm/google_maps/static_map.rb +1 -1
 - data/lib/bhm/google_maps/version.rb +1 -1
 - metadata +5 -5
 
    
        data/bhm-google-maps.gemspec
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = %q{bhm-google-maps}
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "0. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.3.0"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Darcy Laycock"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = %q{2010-08- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2010-08-24}
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = %q{A set of helpers and javascript files that makes it trivial to implement google maps unobtrusively in an application.}
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.email = %q{darcy.laycock@youthtree.org.au}
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.extra_rdoc_files = [
         
     | 
    
        data/coffeescripts/gmap.coffee
    CHANGED
    
    | 
         @@ -39,13 +39,13 @@ 
     | 
|
| 
       39 
39 
     | 
    
         
             
              # automatically namespaces keys etc.
         
     | 
| 
       40 
40 
     | 
    
         
             
              mergeDataOptions = (element, options, keys, spacer) ->
         
     | 
| 
       41 
41 
     | 
    
         
             
                for key in keys
         
     | 
| 
       42 
     | 
    
         
            -
                  options[key] = getData(element, key, spacer) if hasData 
     | 
| 
      
 42 
     | 
    
         
            +
                  options[key] = getData(element, key, spacer) if hasData(element, key, spacer)
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
              # Return the map options for a given element.
         
     | 
| 
       45 
45 
     | 
    
         
             
              mapOptionsForElement = (element) ->
         
     | 
| 
       46 
46 
     | 
    
         
             
                options = $.extend {}, map.defaultOptions
         
     | 
| 
       47 
47 
     | 
    
         
             
                # Set the mapTypeId if it's a function
         
     | 
| 
       48 
     | 
    
         
            -
                options.mapTypeId = options.mapTypeId() if $.isFunction 
     | 
| 
      
 48 
     | 
    
         
            +
                options.mapTypeId = options.mapTypeId() if $.isFunction(options.mapTypeId)
         
     | 
| 
       49 
49 
     | 
    
         
             
                mergeDataOptions  element, options, mapOptionKeys
         
     | 
| 
       50 
50 
     | 
    
         
             
                options
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
         @@ -60,13 +60,11 @@ 
     | 
|
| 
       60 
60 
     | 
    
         
             
                id = $e.attr "id"
         
     | 
| 
       61 
61 
     | 
    
         
             
                $e.attr "id", "#{map.autoIDPrefix}#{map.count++}" unless id?
         
     | 
| 
       62 
62 
     | 
    
         
             
                # Get the position of the current marker.
         
     | 
| 
       63 
     | 
    
         
            -
                if hasData 
     | 
| 
      
 63 
     | 
    
         
            +
                if hasData($e, "latitude") and hasData($e, "longitude")
         
     | 
| 
       64 
64 
     | 
    
         
             
                  lat = Number getData($e, "latitude")
         
     | 
| 
       65 
65 
     | 
    
         
             
                  lng = Number getData($e, "longitude")
         
     | 
| 
       66 
     | 
    
         
            -
                  map.drawLatLng $e, e, lat, lng
         
     | 
| 
       67 
66 
     | 
    
         
             
                else
         
     | 
| 
       68 
     | 
    
         
            -
                   
     | 
| 
       69 
     | 
    
         
            -
                  # TODO: Map the address.
         
     | 
| 
      
 67 
     | 
    
         
            +
                  return
         
     | 
| 
       70 
68 
     | 
    
         
             
                point = new google.maps.LatLng lat, lng
         
     | 
| 
       71 
69 
     | 
    
         
             
                # Start setting up the map / create a map element.
         
     | 
| 
       72 
70 
     | 
    
         
             
                mapOptions = mapOptionsForElement $e
         
     | 
| 
         @@ -78,9 +76,9 @@ 
     | 
|
| 
       78 
76 
     | 
    
         
             
                markerOptions =
         
     | 
| 
       79 
77 
     | 
    
         
             
                  position: point
         
     | 
| 
       80 
78 
     | 
    
         
             
                  map:      currentMap
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
79 
     | 
    
         
             
                mergeDataOptions $e, markerOptions, markerOptionKeys, "marker-"
         
     | 
| 
       83 
80 
     | 
    
         
             
                marker = new google.maps.Marker markerOptions
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
       84 
82 
     | 
    
         
             
                currentMap
         
     | 
| 
       85 
83 
     | 
    
         | 
| 
       86 
84 
     | 
    
         
             
              # On load, we'll install the maps.
         
     | 
    
        data/javascripts/gmap.js
    CHANGED
    
    | 
         @@ -51,18 +51,17 @@ this['GMap'] = (function($) { 
     | 
|
| 
       51 
51 
     | 
    
         
             
                });
         
     | 
| 
       52 
52 
     | 
    
         
             
              };
         
     | 
| 
       53 
53 
     | 
    
         
             
              map.setupElement = function(e) {
         
     | 
| 
       54 
     | 
    
         
            -
                var $e,  
     | 
| 
      
 54 
     | 
    
         
            +
                var $e, currentMap, id, lat, lng, mapOptions, marker, markerOptions, point;
         
     | 
| 
       55 
55 
     | 
    
         
             
                $e = $(e);
         
     | 
| 
       56 
56 
     | 
    
         
             
                id = $e.attr("id");
         
     | 
| 
       57 
57 
     | 
    
         
             
                if (!((typeof id !== "undefined" && id !== null))) {
         
     | 
| 
       58 
58 
     | 
    
         
             
                  $e.attr("id", ("" + (map.autoIDPrefix) + (map.count++)));
         
     | 
| 
       59 
59 
     | 
    
         
             
                }
         
     | 
| 
       60 
     | 
    
         
            -
                if (hasData($e, "latitude" && hasData($e, "longitude")) 
     | 
| 
      
 60 
     | 
    
         
            +
                if (hasData($e, "latitude") && hasData($e, "longitude")) {
         
     | 
| 
       61 
61 
     | 
    
         
             
                  lat = Number(getData($e, "latitude"));
         
     | 
| 
       62 
62 
     | 
    
         
             
                  lng = Number(getData($e, "longitude"));
         
     | 
| 
       63 
     | 
    
         
            -
                  map.drawLatLng($e, e, lat, lng);
         
     | 
| 
       64 
63 
     | 
    
         
             
                } else {
         
     | 
| 
       65 
     | 
    
         
            -
                   
     | 
| 
      
 64 
     | 
    
         
            +
                  return null;
         
     | 
| 
       66 
65 
     | 
    
         
             
                }
         
     | 
| 
       67 
66 
     | 
    
         
             
                point = new google.maps.LatLng(lat, lng);
         
     | 
| 
       68 
67 
     | 
    
         
             
                mapOptions = mapOptionsForElement($e);
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: bhm-google-maps
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 19
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 8 
     | 
    
         
            +
              - 3
         
     | 
| 
      
 9 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.3.0
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Darcy Laycock
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2010-08- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2010-08-24 00:00:00 +08:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       21 
21 
     | 
    
         |