radiant-event_map-extension 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -22,10 +22,12 @@ or as a gem:
22
22
 
23
23
  ## Configuration
24
24
 
25
- There is one required config setting:
25
+ There is one required config setting if you're using the full-page map controller:
26
26
 
27
27
  * `event_map.layout` is the name of the layout used by the controller
28
28
 
29
+ If you're only using the `events:googlemap` radius tag then this isn't required.
30
+
29
31
  ## Basic Usage
30
32
 
31
33
  ### Linking to maps
@@ -37,13 +39,21 @@ There are also two shortcuts:
37
39
  * 'google' is the default and equivalent to `http://maps.google.com/maps?q=:lat+:lng+(:title)` and will drop a pin on a google map.
38
40
  * 'bing' is equivalent to `http://www.bing.com/maps/?v=2&cp=:lat~:lng&rtp=~pos.:lat_:lng_:title&lvl=15&sty=s&eo=0`, which will display a 1:25000 ordnance survey map (if you're in the UK) with a destination flag at your chosen point.
39
41
 
42
+ ### Placing a map on one of your pages
43
+
44
+ For simple uses this radius tag might suffice:
45
+
46
+ <r:events:googlemap [calendar="slug"] />
47
+
48
+ For more searchability you need to use the full-page map controller.
49
+
40
50
  ### Displaying a map page
41
51
 
42
52
  Create a layout that includes a `map_canvas` div and these page parts:
43
53
 
44
54
  * `map_js` is required. It brings in the javascripts (and can be used in the header or at the end of the page as you prefer)
45
55
  * `title` is the page title and can also be shown with `r:title`
46
- * `faceting` here only gives the option to remove any date filters that have been applied. If you add the `taggable_events` extension it gets more useful.
56
+ * `faceting` gives the option to remove any date filters that have been applied. If you add the `taggable_events` extension it gets more useful.
47
57
 
48
58
  Here's a starting point:
49
59
 
@@ -76,28 +86,16 @@ NB. we're not doing anything fancy here with offsets or masks: if you need that
76
86
 
77
87
  ### javascript compatibility
78
88
 
79
- The map javascript is generated by the EventVenuesController using `app/views/event_venues/index.js.erb`. It provides a `build_map_and_markers` method and the minimal jQuery hook required to populate #map_canvas when the DOM loads.
80
-
81
- If you're not using jQuery you should find it straightforward to call `build_map_and_markers(div element)` from another script, and in that case you don't have to use our naming scheme either.
82
-
83
- ### Displaying a map on a normal radiant page
84
-
85
- <r:events:googlemap calendar="slug" />
86
-
87
- If you omit the calendar attribute then all future events will be displayed.
88
-
89
- The map will be presented in a `div#map_canvas` to which your stylesheet will need to give dimensions (and any text styles you want to apply the location bubbles).
90
-
91
- At the moment you don't get any other control of displayed events, but soon the radius tag will support all the usual period specifications.
89
+ The map javascript is generated by the EventVenuesController using `app/views/event_venues/index.js.erb`. You should find that it automatically populates the map with or without jquery present.
92
90
 
93
91
  ### JSON interface
94
92
 
95
93
  If you don't want to use the included scripts, you can skip that whole mechanism and work with the event data instead. EventVenuesController provides a simple JSON interface. Usually it's at /map and looks for addresses like this:
96
94
 
97
- /map everything
95
+ /map everything
98
96
  /map/2010 events in 2010
99
- /map/2010/12/ events in December 2010
100
- /map/2010/12/12 events on 12 December 2010
97
+ /map/2010/12/ events in December 2010
98
+ /map/2010/12/12 events on 12 December 2010
101
99
 
102
100
  If you're using `taggable_events` then we also inherit the tag-faceting interface here.
103
101
 
@@ -107,6 +105,6 @@ If you're using `taggable_events` then we also inherit the tag-faceting interfac
107
105
 
108
106
  ## Author & Copyright
109
107
 
110
- Copyright 2008-2010 Will at spanner.org.
108
+ Copyright 2008-2011 Will at spanner.org.
111
109
 
112
110
  Released under the same terms as Radiant and/or Rails.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.2
1
+ 1.3.3
@@ -1,15 +1,6 @@
1
- if(typeof jQuery == 'function') {
2
- jQuery.fn.populate_map = function() {
3
- this.each(function() { build_map_and_markers(this); });
4
- };
5
-
6
- jQuery(function() {
7
- jQuery("#map_canvas").populate_map();
8
- });
9
- }
10
-
11
1
  function build_map_and_markers(element) {
12
- if (element != null) {
2
+ if (!element) element = document.getElementById('map_canvas');
3
+ if (element) {
13
4
  var map = new google.maps.Map(element, {
14
5
  mapTypeId: google.maps.MapTypeId.<%= (Radiant::Config['event_map.googlemap.type'] || 'ROADMAP').upcase %>,
15
6
  mapTypeControlOptions: {
@@ -42,6 +33,15 @@ function add_marker (map, mark) {
42
33
  google.maps.event.addListener(marker, 'click', function() { infowindow.open(map, marker); });
43
34
  }
44
35
 
36
+ if(typeof jQuery == 'function') {
37
+ jQuery.fn.populate_map = function() { this.each(function() { build_map_and_markers(this); }); };
38
+ jQuery(function() { jQuery("#map_canvas").populate_map(); });
39
+ } else {
40
+ window.onLoad = build_map_and_markers;
41
+ }
42
+
43
+
44
+
45
45
 
46
46
 
47
47
 
@@ -2,7 +2,7 @@
2
2
  # require_dependency 'application_controller'
3
3
 
4
4
  class EventMapExtension < Radiant::Extension
5
- version "1.3.2"
5
+ version "1.3.3"
6
6
  description "Small additions to geocode calendar events and display on a map, separated here because only of interest to a few."
7
7
  url "spanner.org"
8
8
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-event_map-extension}
8
- s.version = "1.3.2"
8
+ s.version = "1.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["spanner"]
12
- s.date = %q{2010-12-09}
12
+ s.date = %q{2011-02-07}
13
13
  s.description = %q{Further extends the event_calendar extension to allow easy google mapping with automatic geolocation based on event venues}
14
14
  s.email = %q{will@spanner.org}
15
15
  s.extra_rdoc_files = [
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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 2
10
- version: 1.3.2
9
+ - 3
10
+ version: 1.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - spanner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-09 00:00:00 +00:00
18
+ date: 2011-02-07 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency