radiant-event_map-extension 1.3.4 → 1.3.5

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/lib/grid_ref.rb CHANGED
@@ -266,14 +266,27 @@ end
266
266
 
267
267
  class String
268
268
  def is_gridref?
269
- self.upcase =~ /^(H(P|T|U|Y|Z)|N(A|B|C|D|F|G|H|J|K|L|M|N|O|R|S|T|U|W|X|Y|Z)|OV|S(C|D|E|G|H|J|K|M|N|O|P|R|S|T|U|W|X|Y|Z)|T(A|F|G|L|M|Q|R|V)){1}\d{4}(NE|NW|SE|SW)?$|((H(P|T|U|Y|Z)|N(A|B|C|D|F|G|H|J|K|L|M|N|O|R|S|T|U|W|X|Y|Z)|OV|S(C|D|E|G|H|J|K|M|N|O|P|R|S|T|U|W|X|Y|Z)|T(A|F|G|L|M|Q|R|V)){1}(\d{4}|\d{6}|\d{8}|\d{10}))$/
269
+ !!(self.upcase =~ /^(H(P|T|U|Y|Z)|N(A|B|C|D|F|G|H|J|K|L|M|N|O|R|S|T|U|W|X|Y|Z)|OV|S(C|D|E|G|H|J|K|M|N|O|P|R|S|T|U|W|X|Y|Z)|T(A|F|G|L|M|Q|R|V)){1}\d{4}(NE|NW|SE|SW)?$|((H(P|T|U|Y|Z)|N(A|B|C|D|F|G|H|J|K|L|M|N|O|R|S|T|U|W|X|Y|Z)|OV|S(C|D|E|G|H|J|K|M|N|O|P|R|S|T|U|W|X|Y|Z)|T(A|F|G|L|M|Q|R|V)){1}(\d{4}|\d{6}|\d{8}|\d{10}))$/)
270
+ end
271
+
272
+ def is_latlng?
273
+ !!(self =~ /(-?\d+\.\d+)[,\s]+(-?\d+\.\d+)/)
270
274
  end
271
275
 
272
276
  def to_latlng(options = {})
273
- GridRef.new(self, options).to_latlng if self.is_gridref?
277
+ if is_latlng?
278
+ self
279
+ elsif is_gridref?
280
+ GridRef.new(self, options).to_latlng
281
+ end
274
282
  end
275
283
 
276
284
  def to_wgs84(options = {})
277
- GridRef.new(self, options.merge(:datum => :wgs84)).to_latlng if self.is_gridref?
285
+ if is_latlng?
286
+ self
287
+ elsif is_gridref?
288
+ GridRef.new(self, options.merge(:datum => :wgs84)).to_latlng
289
+ end
278
290
  end
291
+
279
292
  end
data/lib/mappable.rb CHANGED
@@ -50,7 +50,8 @@ private
50
50
  if geocode_basis.is_gridref? && gr = GridRef.new(geocode_basis, :datum => :wgs84, :accuracy => 8) # for gps and site compatibility wgs84 is better than osgb36
51
51
  self.lat = gr.lat
52
52
  self.lng = gr.lng
53
- puts "new lat/lng: #{self.lat}/#{self.lng}"
53
+ elsif geocode_basis.is_latlong?
54
+ self.lat, self.lng = geocode_basis.split(/, */)
54
55
  else
55
56
  bias = Radiant::Config['event_map.zone'] || 'uk'
56
57
  geo = Geokit::Geocoders::MultiGeocoder.geocode(location, :bias => bias)
@@ -1,5 +1,5 @@
1
1
  module RadiantEventMapExtension
2
- VERSION = '1.3.4'
2
+ VERSION = '1.3.5'
3
3
  SUMMARY = %Q{Event geocoding and map extension for Radiant CMS}
4
4
  DESCRIPTION = "Small additions to the event_calendar that geocode calendar events and display on a google map. Separated here because perhaps only of interest to a few."
5
5
  URL = "http://github.com/radiant/radiant-event_calendar-extension"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-event_map-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 4
10
- version: 1.3.4
9
+ - 5
10
+ version: 1.3.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - William Ross
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-05 00:00:00 Z
18
+ date: 2011-07-18 00:00:00 +01:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: geokit
@@ -80,6 +81,7 @@ files:
80
81
  - lib/tasks/event_map_extension_tasks.rake
81
82
  - public/images/map_icons/pink-dot.png
82
83
  - public/images/map_icons/shadow.png
84
+ - radiant-event_map-extension-1.3.4.gem
83
85
  - radiant-event_map-extension.gemspec
84
86
  - Rakefile
85
87
  - README.md
@@ -87,10 +89,11 @@ files:
87
89
  - spec/spec.opts
88
90
  - spec/spec_helper.rb
89
91
  - VERSION
92
+ has_rdoc: true
90
93
  homepage: http://github.com/radiant/radiant-event_calendar-extension
91
94
  licenses: []
92
95
 
93
- post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-event_map-extension', :version => '~> 1.3.4'\n\n "
96
+ post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-event_map-extension', :version => '~> 1.3.5'\n\n "
94
97
  rdoc_options: []
95
98
 
96
99
  require_paths:
@@ -116,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
119
  requirements: []
117
120
 
118
121
  rubyforge_project:
119
- rubygems_version: 1.7.2
122
+ rubygems_version: 1.5.3
120
123
  signing_key:
121
124
  specification_version: 3
122
125
  summary: Event geocoding and map extension for Radiant CMS