radiant-event_map-extension 1.1.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/README.md +95 -0
- data/Rakefile +138 -0
- data/VERSION +1 -0
- data/app/controllers/event_venues_controller.rb +50 -0
- data/app/views/event_venues/_event.html.haml +20 -0
- data/app/views/event_venues/_venue.html.haml +23 -0
- data/app/views/event_venues/index.html.haml +17 -0
- data/app/views/event_venues/index.js.erb +55 -0
- data/app/views/events/_views.html.haml +11 -0
- data/config/routes.rb +8 -0
- data/cucumber.yml +1 -0
- data/db/migrate/20100311101802_lat_long.rb +20 -0
- data/db/migrate/20100311105231_get_geocodes.rb +17 -0
- data/event_map_extension.rb +19 -0
- data/features/support/env.rb +16 -0
- data/features/support/paths.rb +14 -0
- data/lib/angle_conversions.rb +9 -0
- data/lib/grid_ref.rb +279 -0
- data/lib/mappable.rb +63 -0
- data/lib/tasks/event_map_extension_tasks.rake +28 -0
- data/pkg/radiant-event_map-extension-1.0.1.gem +0 -0
- data/public/images/event_calendar/event_shadow.png +0 -0
- data/public/images/event_calendar/one_event.png +0 -0
- data/public/images/event_calendar/several_events.png +0 -0
- data/public/javascript/markerclusterer.js +735 -0
- data/public/stylesheets/sass/map.sass +11 -0
- data/radiant-event_map-extension.gemspec +79 -0
- data/spec/lib/grid_ref_spec.rb +90 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +36 -0
- metadata +140 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{radiant-event_map-extension}
|
8
|
+
s.version = "1.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["spanner"]
|
12
|
+
s.date = %q{2010-09-30}
|
13
|
+
s.description = %q{Further extends the event_calendar extension to allow easy google mapping with automatic geolocation based on event venues}
|
14
|
+
s.email = %q{will@spanner.org}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"README.md",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"app/controllers/event_venues_controller.rb",
|
23
|
+
"app/views/event_venues/_event.html.haml",
|
24
|
+
"app/views/event_venues/_venue.html.haml",
|
25
|
+
"app/views/event_venues/index.html.haml",
|
26
|
+
"app/views/event_venues/index.js.erb",
|
27
|
+
"app/views/events/_views.html.haml",
|
28
|
+
"config/routes.rb",
|
29
|
+
"cucumber.yml",
|
30
|
+
"db/migrate/20100311101802_lat_long.rb",
|
31
|
+
"db/migrate/20100311105231_get_geocodes.rb",
|
32
|
+
"event_map_extension.rb",
|
33
|
+
"features/support/env.rb",
|
34
|
+
"features/support/paths.rb",
|
35
|
+
"lib/angle_conversions.rb",
|
36
|
+
"lib/grid_ref.rb",
|
37
|
+
"lib/mappable.rb",
|
38
|
+
"lib/tasks/event_map_extension_tasks.rake",
|
39
|
+
"pkg/radiant-event_map-extension-1.0.1.gem",
|
40
|
+
"public/images/event_calendar/event_shadow.png",
|
41
|
+
"public/images/event_calendar/one_event.png",
|
42
|
+
"public/images/event_calendar/several_events.png",
|
43
|
+
"public/javascript/markerclusterer.js",
|
44
|
+
"public/stylesheets/sass/map.sass",
|
45
|
+
"radiant-event_map-extension.gemspec",
|
46
|
+
"spec/lib/grid_ref_spec.rb",
|
47
|
+
"spec/spec.opts",
|
48
|
+
"spec/spec_helper.rb"
|
49
|
+
]
|
50
|
+
s.homepage = %q{http://github.com/radiant/radiant-event_map-extension}
|
51
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
52
|
+
s.require_paths = ["lib"]
|
53
|
+
s.rubygems_version = %q{1.3.7}
|
54
|
+
s.summary = %q{Google mapping for events in the radiant CMS}
|
55
|
+
s.test_files = [
|
56
|
+
"spec/lib/grid_ref_spec.rb",
|
57
|
+
"spec/spec_helper.rb"
|
58
|
+
]
|
59
|
+
|
60
|
+
if s.respond_to? :specification_version then
|
61
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
62
|
+
s.specification_version = 3
|
63
|
+
|
64
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
65
|
+
s.add_runtime_dependency(%q<geokit>, [">= 0"])
|
66
|
+
s.add_runtime_dependency(%q<radiant>, [">= 0.9.0"])
|
67
|
+
s.add_runtime_dependency(%q<radiant-event_calendar-extension>, [">= 0"])
|
68
|
+
else
|
69
|
+
s.add_dependency(%q<geokit>, [">= 0"])
|
70
|
+
s.add_dependency(%q<radiant>, [">= 0.9.0"])
|
71
|
+
s.add_dependency(%q<radiant-event_calendar-extension>, [">= 0"])
|
72
|
+
end
|
73
|
+
else
|
74
|
+
s.add_dependency(%q<geokit>, [">= 0"])
|
75
|
+
s.add_dependency(%q<radiant>, [">= 0.9.0"])
|
76
|
+
s.add_dependency(%q<radiant-event_calendar-extension>, [">= 0"])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe GridRef do
|
4
|
+
|
5
|
+
it "should reject a bad gridref string" do
|
6
|
+
lambda{ GridRef.new("S123456") }.should raise_error
|
7
|
+
lambda{ GridRef.new("SD12345") }.should raise_error
|
8
|
+
lambda{ GridRef.new("SD123456") }.should_not raise_error
|
9
|
+
lambda{ GridRef.new("SD1234567890") }.should_not raise_error
|
10
|
+
end
|
11
|
+
|
12
|
+
describe " standard transformation" do
|
13
|
+
before do
|
14
|
+
@gr = GridRef.new("SD2873178452")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should calculate grid square offset" do
|
18
|
+
@gr.offsets[:n].should == 400000
|
19
|
+
@gr.offsets[:e].should == 300000
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should calculate northing" do
|
23
|
+
@gr.northing.should == 478452
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should calculate easting" do
|
27
|
+
@gr.easting.should == 328731
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should calculate latitude and longitude" do
|
31
|
+
@gr.coordinates[:lat].should be_close(0.945910830410541, 0.000001)
|
32
|
+
@gr.coordinates[:lng].should be_close(-0.0539749456547823, 0.000001)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should return latitude and longitude in degrees" do
|
36
|
+
@gr.lat.should == 54.196698
|
37
|
+
@gr.lng.should == -3.092537
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should return the right number of decimal places" do
|
41
|
+
GridRef.new("SD2873178452", :precision => 2).lat.should == 54.20
|
42
|
+
GridRef.new("SD2873178452", :precision => 4).lat.should == 54.1967
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe " wgs84 transformation" do
|
47
|
+
before do
|
48
|
+
@gr = GridRef.new("SD2873178452", :datum => :wgs84)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should calculate latitude and longitude" do
|
52
|
+
@gr.coordinates[:lat].should be_close(0.945913481900098, 0.000001)
|
53
|
+
@gr.coordinates[:lng].should be_close(-0.0539987551350719, 0.000001)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return latitude and longitude in degrees" do
|
57
|
+
@gr.lat.should == 54.196850
|
58
|
+
@gr.lng.should == -3.093901
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe String do
|
64
|
+
describe "that is a grid reference" do
|
65
|
+
it "should respond positively to .is_gridref?" do
|
66
|
+
"SD123456".is_gridref?.should be_true
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should respond to .to_latlng with coordinates" do
|
70
|
+
"SD2873178452".to_latlng.should == "54.196698, -3.092537"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should pass through options to the grid ref" do
|
74
|
+
"SD2873178452".to_latlng(:datum => :wgs84).should == "54.19685, -3.093901"
|
75
|
+
"SD2873178452".to_wgs84.should == "54.19685, -3.093901"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "that is a not recognised as a grid reference" do
|
80
|
+
it "should respond negatively to .is_gridref?" do
|
81
|
+
"banana".is_gridref?.should be_false
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should return nil to .to_latlng" do
|
85
|
+
lambda{ "banana".to_latlng }.should_not raise_error
|
86
|
+
"banana".to_latlng.should be_nil
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
unless defined? RADIANT_ROOT
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
case
|
4
|
+
when ENV["RADIANT_ENV_FILE"]
|
5
|
+
require ENV["RADIANT_ENV_FILE"]
|
6
|
+
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
|
7
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment"
|
8
|
+
else
|
9
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
require "#{RADIANT_ROOT}/spec/spec_helper"
|
13
|
+
|
14
|
+
Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
|
15
|
+
|
16
|
+
if File.directory?(File.dirname(__FILE__) + "/matchers")
|
17
|
+
Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
|
18
|
+
end
|
19
|
+
|
20
|
+
Spec::Runner.configure do |config|
|
21
|
+
# config.use_transactional_fixtures = true
|
22
|
+
# config.use_instantiated_fixtures = false
|
23
|
+
# config.fixture_path = RAILS_ROOT + '/spec/fixtures'
|
24
|
+
|
25
|
+
# You can declare fixtures for each behaviour like this:
|
26
|
+
# describe "...." do
|
27
|
+
# fixtures :table_a, :table_b
|
28
|
+
#
|
29
|
+
# Alternatively, if you prefer to declare them only once, you can
|
30
|
+
# do so here, like so ...
|
31
|
+
#
|
32
|
+
# config.global_fixtures = :table_a, :table_b
|
33
|
+
#
|
34
|
+
# If you declare global fixtures, be aware that they will be declared
|
35
|
+
# for all of your examples, even those that don't use them.
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: radiant-event_map-extension
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 1.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- spanner
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-09-30 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: geokit
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: radiant
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 59
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
- 9
|
47
|
+
- 0
|
48
|
+
version: 0.9.0
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: radiant-event_calendar-extension
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
type: :runtime
|
64
|
+
version_requirements: *id003
|
65
|
+
description: Further extends the event_calendar extension to allow easy google mapping with automatic geolocation based on event venues
|
66
|
+
email: will@spanner.org
|
67
|
+
executables: []
|
68
|
+
|
69
|
+
extensions: []
|
70
|
+
|
71
|
+
extra_rdoc_files:
|
72
|
+
- README.md
|
73
|
+
files:
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- VERSION
|
77
|
+
- app/controllers/event_venues_controller.rb
|
78
|
+
- app/views/event_venues/_event.html.haml
|
79
|
+
- app/views/event_venues/_venue.html.haml
|
80
|
+
- app/views/event_venues/index.html.haml
|
81
|
+
- app/views/event_venues/index.js.erb
|
82
|
+
- app/views/events/_views.html.haml
|
83
|
+
- config/routes.rb
|
84
|
+
- cucumber.yml
|
85
|
+
- db/migrate/20100311101802_lat_long.rb
|
86
|
+
- db/migrate/20100311105231_get_geocodes.rb
|
87
|
+
- event_map_extension.rb
|
88
|
+
- features/support/env.rb
|
89
|
+
- features/support/paths.rb
|
90
|
+
- lib/angle_conversions.rb
|
91
|
+
- lib/grid_ref.rb
|
92
|
+
- lib/mappable.rb
|
93
|
+
- lib/tasks/event_map_extension_tasks.rake
|
94
|
+
- pkg/radiant-event_map-extension-1.0.1.gem
|
95
|
+
- public/images/event_calendar/event_shadow.png
|
96
|
+
- public/images/event_calendar/one_event.png
|
97
|
+
- public/images/event_calendar/several_events.png
|
98
|
+
- public/javascript/markerclusterer.js
|
99
|
+
- public/stylesheets/sass/map.sass
|
100
|
+
- radiant-event_map-extension.gemspec
|
101
|
+
- spec/lib/grid_ref_spec.rb
|
102
|
+
- spec/spec.opts
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
has_rdoc: true
|
105
|
+
homepage: http://github.com/radiant/radiant-event_map-extension
|
106
|
+
licenses: []
|
107
|
+
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options:
|
110
|
+
- --charset=UTF-8
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
hash: 3
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
version: "0"
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
hash: 3
|
128
|
+
segments:
|
129
|
+
- 0
|
130
|
+
version: "0"
|
131
|
+
requirements: []
|
132
|
+
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 1.3.7
|
135
|
+
signing_key:
|
136
|
+
specification_version: 3
|
137
|
+
summary: Google mapping for events in the radiant CMS
|
138
|
+
test_files:
|
139
|
+
- spec/lib/grid_ref_spec.rb
|
140
|
+
- spec/spec_helper.rb
|