campfire_logic 1.1.9 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/VERSION +1 -1
- data/app/models/locale.rb +1 -0
- data/app/views/directory/search.html.erb +2 -2
- data/app/views/directory/show.html.erb +3 -3
- data/app/views/shared/_map.html.erb +79 -2
- data/campfire_logic.gemspec +9 -9
- metadata +13 -13
data/Gemfile
CHANGED
@@ -3,9 +3,9 @@ source 'http://rubygems.org'
|
|
3
3
|
gem 'bson_ext'
|
4
4
|
gem 'fastercsv'
|
5
5
|
gem 'google_maps_geocoder'
|
6
|
-
gem 'mongoid'
|
6
|
+
gem 'mongoid'
|
7
7
|
gem 'mongoid-tree'
|
8
|
-
gem 'rails', '~> 3.
|
8
|
+
gem 'rails', '~> 3.0.0'
|
9
9
|
gem 'scaffold_logic'
|
10
10
|
gem 'stateflow'
|
11
11
|
gem 'stringex'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.10
|
data/app/models/locale.rb
CHANGED
@@ -24,6 +24,7 @@ class Locale
|
|
24
24
|
# Scopes =========================================================================================
|
25
25
|
scope :canada, :where => {:name => 'Canada'}
|
26
26
|
scope :cities, :where => {:kind => 'city' }
|
27
|
+
scope :countries, :where => {:kind => 'country'}
|
27
28
|
scope :locations, :where => {:kind => 'location'}
|
28
29
|
scope :states, :where => {:kind => 'state'}
|
29
30
|
scope :us, :where => {:name => 'United States'}
|
@@ -25,7 +25,7 @@
|
|
25
25
|
<script type="text/javascript">
|
26
26
|
initializeMap();
|
27
27
|
|
28
|
-
$('search-form').addEventListener('submit', function (e) {
|
29
|
-
window.location = '<%= directory_search_root_url -%>/' + $('search-input').value;
|
28
|
+
$('#search-form')[0].addEventListener('submit', function (e) {
|
29
|
+
window.location = '<%= directory_search_root_url -%>/' + $('#search-input')[0].value;
|
30
30
|
}, false);
|
31
31
|
</script>
|
@@ -24,9 +24,9 @@
|
|
24
24
|
initializeMap();
|
25
25
|
|
26
26
|
// change search-form's action so its query string can be converted to a URL
|
27
|
-
$('search-form').action = 'javascript:return(false);';
|
27
|
+
$('#search-form')[0].action = 'javascript:return(false);';
|
28
28
|
|
29
|
-
$('search-form').addEventListener('submit', function (e) {
|
30
|
-
window.location = '<%= directory_search_root_url -%>/' + $('search-input').value;
|
29
|
+
$('#search-form')[0].addEventListener('submit', function (e) {
|
30
|
+
window.location = '<%= directory_search_root_url -%>/' + $('#search-input')[0].value;
|
31
31
|
}, false);
|
32
32
|
</script>
|
@@ -1,2 +1,79 @@
|
|
1
|
-
<%# requires local variables: locations AND place; Adapted from http://code.google.com/apis/maps/documentation/javascript/examples/icon-complex.html
|
2
|
-
|
1
|
+
<%# requires local variables: locations AND place; Adapted from http://code.google.com/apis/maps/documentation/javascript/examples/icon-complex.html -%>
|
2
|
+
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
3
|
+
<script>
|
4
|
+
var directionsDisplay = new google.maps.DirectionsRenderer();
|
5
|
+
var directionsService = new google.maps.DirectionsService();
|
6
|
+
var locations = [
|
7
|
+
<%- if place && place.location? && place.geocoded? -%>
|
8
|
+
<%= raw "['#{h(escape_javascript place.location.name)}', #{place.lat_lng[0]}, #{place.lat_lng[1]}, '#{h(escape_javascript place.location.name)}<br />#{h(escape_javascript place.location.address1)}<br />#{h(escape_javascript place.location.city)}, #{h(escape_javascript place.location.state)} #{h(escape_javascript place.location.zip)}<br /><br />Directions: <a href=\"javascript:showDirectionsTo(0)\">To here<\/a> / <a href=\"javascript:showDirectionsFrom(0)\">From here<\/a>']" -%>
|
9
|
+
<%- else -%>
|
10
|
+
<%= raw locations.select{ |l| l.geocoded? }.inject([]) { |a, l| i = a.size; a << "['#{h(escape_javascript l.name)}', #{l.lat_lng[0]}, #{l.lat_lng[1]}, '#{link_to h(escape_javascript l.name), l.locale.to_url}<br />#{h(escape_javascript l.address1)}<br />#{h(escape_javascript l.city)}, #{h(escape_javascript l.state)} #{h(escape_javascript l.zip)}<br /><br />Directions: <a href=\"javascript:showDirectionsTo(#{i})\">To here<\/a> / <a href=\"javascript:showDirectionsFrom(#{i})\">From here<\/a>']"; a } * ",\r" -%>
|
11
|
+
<%- end -%>
|
12
|
+
];
|
13
|
+
var map;
|
14
|
+
var markers = [];
|
15
|
+
var openWindow;
|
16
|
+
|
17
|
+
function initializeMap() {
|
18
|
+
var myOptions = {
|
19
|
+
zoom: <%= place && place.zoom_level || 4 -%>,
|
20
|
+
<%- if place && place.geocoded? -%>
|
21
|
+
center: new google.maps.LatLng(<%= place.lat_lng[0] -%>, <%= place.lat_lng[1] -%>),
|
22
|
+
<%- elsif place && place.parent && place.parent.geocoded? -%>
|
23
|
+
center: new google.maps.LatLng(<%= place.parent.lat_lng[0] -%>, <%= place.parent.lat_lng[1] -%>),
|
24
|
+
<%- else -%>
|
25
|
+
center: new google.maps.LatLng(37.09024, -95.712891),
|
26
|
+
<%- end -%>
|
27
|
+
mapTypeId: google.maps.MapTypeId.ROADMAP
|
28
|
+
};
|
29
|
+
map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
|
30
|
+
directionsDisplay.setMap(map);
|
31
|
+
directionsDisplay.setPanel($('#directions_panel')[0]);
|
32
|
+
for (var i = 0; i < locations.length; i++) {
|
33
|
+
markers[i] = new google.maps.Marker({
|
34
|
+
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
|
35
|
+
map: map
|
36
|
+
});
|
37
|
+
attachBalloon(i, locations[i][3]);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
function attachBalloon(i, content) {
|
42
|
+
google.maps.event.addListener(markers[i], 'click', function() {
|
43
|
+
if (openWindow != undefined) {
|
44
|
+
openWindow.close();
|
45
|
+
}
|
46
|
+
openWindow = new google.maps.InfoWindow({
|
47
|
+
content: '<div class=map-balloon id=open-balloon>' + content + '</div>'
|
48
|
+
});
|
49
|
+
openWindow.open(map, markers[i]);
|
50
|
+
$('#open-balloon')[0].parentNode.style.overflow = 'visible';
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
function calcRoute(start, end) {
|
55
|
+
var request = {
|
56
|
+
origin: start,
|
57
|
+
destination: end,
|
58
|
+
travelMode: google.maps.DirectionsTravelMode.DRIVING
|
59
|
+
};
|
60
|
+
directionsService.route(request, function(response, status) {
|
61
|
+
if (status == google.maps.DirectionsStatus.OK) {
|
62
|
+
directionsDisplay.setDirections(response);
|
63
|
+
openWindow.close();
|
64
|
+
}
|
65
|
+
});
|
66
|
+
}
|
67
|
+
|
68
|
+
function showAddress(i) {
|
69
|
+
$('#open-balloon')[0].innerHTML = locations[i][3];
|
70
|
+
}
|
71
|
+
|
72
|
+
function showDirectionsFrom(i) {
|
73
|
+
$('#open-balloon')[0].innerHTML = 'Directions to:<form action="javascript:calcRoute(\'' + locations[i][1] + ' ' + locations[i][2] + '\', $(\'#directions-input\')[0].value)"><input type=text maxlength=40 name=directions-input id=directions-input style="width: 100%;" /><input value=Go type=submit /><input value=Cancel type=button onclick="showAddress(' + i + ')" /></form>';
|
74
|
+
}
|
75
|
+
|
76
|
+
function showDirectionsTo(i) {
|
77
|
+
$('#open-balloon')[0].innerHTML = 'Directions from:<form action="javascript:calcRoute($(\'#directions-input\')[0].value, \'' + locations[i][1] + ' ' + locations[i][2] + '\')"><input type=text maxlength=40 name=directions-input id=directions-input style="width: 100%;" /><input value=Go type=submit /><input value=Cancel type=button onclick="showAddress(' + i + ')" /></form>';
|
78
|
+
}
|
79
|
+
</script>
|
data/campfire_logic.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "campfire_logic"
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Roderick Monje"]
|
12
|
-
s.date = "2012-01-
|
12
|
+
s.date = "2012-01-23"
|
13
13
|
s.description = "Users can browse locations by country, city, and state and search locations by string or zip code. Administrators can manage locations and the services they offer."
|
14
14
|
s.email = "rod@seologic.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -141,7 +141,7 @@ Gem::Specification.new do |s|
|
|
141
141
|
]
|
142
142
|
s.homepage = "http://github.com/ivanoblomov/campfire_logic"
|
143
143
|
s.require_paths = ["lib"]
|
144
|
-
s.rubygems_version = "1.8.
|
144
|
+
s.rubygems_version = "1.8.10"
|
145
145
|
s.summary = "Rails engine that adds a location directory to your web app"
|
146
146
|
|
147
147
|
if s.respond_to? :specification_version then
|
@@ -151,9 +151,9 @@ Gem::Specification.new do |s|
|
|
151
151
|
s.add_runtime_dependency(%q<bson_ext>, [">= 0"])
|
152
152
|
s.add_runtime_dependency(%q<fastercsv>, [">= 0"])
|
153
153
|
s.add_runtime_dependency(%q<google_maps_geocoder>, [">= 0"])
|
154
|
-
s.add_runtime_dependency(%q<mongoid>, ["
|
154
|
+
s.add_runtime_dependency(%q<mongoid>, [">= 0"])
|
155
155
|
s.add_runtime_dependency(%q<mongoid-tree>, [">= 0"])
|
156
|
-
s.add_runtime_dependency(%q<rails>, ["~> 3.
|
156
|
+
s.add_runtime_dependency(%q<rails>, ["~> 3.0.0"])
|
157
157
|
s.add_runtime_dependency(%q<scaffold_logic>, [">= 0"])
|
158
158
|
s.add_runtime_dependency(%q<stateflow>, [">= 0"])
|
159
159
|
s.add_runtime_dependency(%q<stringex>, [">= 0"])
|
@@ -163,9 +163,9 @@ Gem::Specification.new do |s|
|
|
163
163
|
s.add_dependency(%q<bson_ext>, [">= 0"])
|
164
164
|
s.add_dependency(%q<fastercsv>, [">= 0"])
|
165
165
|
s.add_dependency(%q<google_maps_geocoder>, [">= 0"])
|
166
|
-
s.add_dependency(%q<mongoid>, ["
|
166
|
+
s.add_dependency(%q<mongoid>, [">= 0"])
|
167
167
|
s.add_dependency(%q<mongoid-tree>, [">= 0"])
|
168
|
-
s.add_dependency(%q<rails>, ["~> 3.
|
168
|
+
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
169
169
|
s.add_dependency(%q<scaffold_logic>, [">= 0"])
|
170
170
|
s.add_dependency(%q<stateflow>, [">= 0"])
|
171
171
|
s.add_dependency(%q<stringex>, [">= 0"])
|
@@ -176,9 +176,9 @@ Gem::Specification.new do |s|
|
|
176
176
|
s.add_dependency(%q<bson_ext>, [">= 0"])
|
177
177
|
s.add_dependency(%q<fastercsv>, [">= 0"])
|
178
178
|
s.add_dependency(%q<google_maps_geocoder>, [">= 0"])
|
179
|
-
s.add_dependency(%q<mongoid>, ["
|
179
|
+
s.add_dependency(%q<mongoid>, [">= 0"])
|
180
180
|
s.add_dependency(%q<mongoid-tree>, [">= 0"])
|
181
|
-
s.add_dependency(%q<rails>, ["~> 3.
|
181
|
+
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
182
182
|
s.add_dependency(%q<scaffold_logic>, [">= 0"])
|
183
183
|
s.add_dependency(%q<stateflow>, [">= 0"])
|
184
184
|
s.add_dependency(%q<stringex>, [">= 0"])
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: campfire_logic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 10
|
10
|
+
version: 1.1.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Roderick Monje
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: bson_ext
|
@@ -65,13 +65,12 @@ dependencies:
|
|
65
65
|
requirement: &id004 !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
hash:
|
70
|
+
hash: 3
|
71
71
|
segments:
|
72
|
-
-
|
73
|
-
|
74
|
-
version: "2.4"
|
72
|
+
- 0
|
73
|
+
version: "0"
|
75
74
|
type: :runtime
|
76
75
|
version_requirements: *id004
|
77
76
|
- !ruby/object:Gem::Dependency
|
@@ -96,11 +95,12 @@ dependencies:
|
|
96
95
|
requirements:
|
97
96
|
- - ~>
|
98
97
|
- !ruby/object:Gem::Version
|
99
|
-
hash:
|
98
|
+
hash: 7
|
100
99
|
segments:
|
101
100
|
- 3
|
102
|
-
-
|
103
|
-
|
101
|
+
- 0
|
102
|
+
- 0
|
103
|
+
version: 3.0.0
|
104
104
|
type: :runtime
|
105
105
|
version_requirements: *id006
|
106
106
|
- !ruby/object:Gem::Dependency
|
@@ -335,7 +335,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
335
335
|
requirements: []
|
336
336
|
|
337
337
|
rubyforge_project:
|
338
|
-
rubygems_version: 1.8.
|
338
|
+
rubygems_version: 1.8.10
|
339
339
|
signing_key:
|
340
340
|
specification_version: 3
|
341
341
|
summary: Rails engine that adds a location directory to your web app
|