campfire_logic 1.2.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 2.0.0
@@ -1,4 +1,4 @@
1
- <%# requires local variables: locations AND place; Adapted from http://code.google.com/apis/maps/documentation/javascript/examples/icon-complex.html -%>
1
+ <%# requires local variables: locations AND place (but latter can be nil); Adapted from http://code.google.com/apis/maps/documentation/javascript/examples/icon-complex.html -%>
2
2
  <script src="http://maps.google.com/maps/api/js?sensor=false"></script>
3
3
  <script>
4
4
  var directionsDisplay = new google.maps.DirectionsRenderer();
@@ -14,19 +14,8 @@
14
14
  var markers = [];
15
15
  var openWindow;
16
16
 
17
- function initializeMap(id) {
18
- var myOptions = {
19
- zoom: <%= place && place.zoom_level || 4 -%>,
20
- <%- if place && place.geocoded? -%>
21
- center: new google.maps.LatLng(<%= place.coordinates[1] -%>, <%= place.coordinates[0] -%>),
22
- <%- elsif place && place.parent && place.parent.geocoded? -%>
23
- center: new google.maps.LatLng(<%= place.parent.coordinates[1] -%>, <%= place.parent.coordinates[0] -%>),
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(id), myOptions);
17
+ function initializeMap(id, options) {
18
+ map = new google.maps.Map(document.getElementById(id), options);
30
19
  directionsDisplay.setMap(map);
31
20
  directionsDisplay.setPanel($('#directions_panel')[0]);
32
21
  for (var i = 0; i < locations.length; i++) {
@@ -36,6 +25,7 @@
36
25
  });
37
26
  attachBalloon(i, locations[i][3]);
38
27
  }
28
+ map.fitBounds(calcBounds());
39
29
  }
40
30
 
41
31
  function attachBalloon(i, content) {
@@ -51,6 +41,14 @@
51
41
  });
52
42
  }
53
43
 
44
+ function calcBounds() {
45
+ var latLngList = [<%= locations.map{ |l| "new google.maps.LatLng(#{l.coordinates[1]}, #{l.coordinates[0]})" } * ', ' %>]
46
+ var bounds = new google.maps.LatLngBounds();
47
+ for (var i = 0; i < latLngList.length; i++)
48
+ bounds.extend(latLngList[i]);
49
+ return bounds;
50
+ }
51
+
54
52
  function calcRoute(start, end) {
55
53
  var request = {
56
54
  origin: start,
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "campfire_logic"
8
- s.version = "1.2.1"
8
+ s.version = "2.0.0"
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"]
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: 29
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
- - 1
8
7
  - 2
9
- - 1
10
- version: 1.2.1
8
+ - 0
9
+ - 0
10
+ version: 2.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roderick Monje