radiant-event_map-extension 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +21 -17
- data/VERSION +1 -1
- data/app/controllers/event_venues_controller.rb +2 -2
- data/app/views/event_venues/_event.html.haml +8 -11
- data/app/views/event_venues/_venue.html.haml +5 -2
- data/app/views/event_venues/index.js.erb +6 -19
- data/event_map_extension.rb +2 -1
- data/lib/event_map_tags.rb +26 -0
- data/pkg/radiant-event_map-extension-1.1.0.gem +0 -0
- data/radiant-event_map-extension.gemspec +4 -2
- metadata +6 -4
data/README.md
CHANGED
@@ -47,17 +47,17 @@ Create a layout that includes a `map_canvas` div and these page parts:
|
|
47
47
|
|
48
48
|
Here's a starting point:
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
50
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
51
|
+
<head>
|
52
|
+
<title><r:title /></title>
|
53
|
+
<r:content part="map_js" />
|
54
|
+
</head>
|
55
|
+
<body>
|
56
|
+
<h1 id="pagetitle"><r:title /></h1>
|
57
|
+
<r:content part="faceting" />
|
58
|
+
<div id="map_canvas" style="width: 600px; height 400px;"></div>
|
59
|
+
</body>
|
60
|
+
</html>
|
61
61
|
|
62
62
|
Make sure that `Radiant::Config['event_map.layout']` matches exactly the _name_ of this layout.
|
63
63
|
|
@@ -67,6 +67,16 @@ The map javascript is generated by the EventVenuesController using `app/views/ev
|
|
67
67
|
|
68
68
|
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.
|
69
69
|
|
70
|
+
### Displaying a map on a normal radiant page
|
71
|
+
|
72
|
+
<r:events:googlemap calendar="slug" />
|
73
|
+
|
74
|
+
If you omit the calendar attribute then all future events will be displayed.
|
75
|
+
|
76
|
+
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).
|
77
|
+
|
78
|
+
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.
|
79
|
+
|
70
80
|
### JSON interface
|
71
81
|
|
72
82
|
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:
|
@@ -78,12 +88,6 @@ If you don't want to use the included scripts, you can skip that whole mechanism
|
|
78
88
|
|
79
89
|
If you're using `taggable_events` then we also inherit the tag-faceting interface here.
|
80
90
|
|
81
|
-
The data returned looks like this:
|
82
|
-
|
83
|
-
{
|
84
|
-
|
85
|
-
}
|
86
|
-
|
87
91
|
## Bugs and features
|
88
92
|
|
89
93
|
[Github issues](http://github.com/spanner/radiant-event_map-extension/issues) please, or for little things an email or github message is fine.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
@@ -4,17 +4,14 @@
|
|
4
4
|
.map_event
|
5
5
|
- unless without_title
|
6
6
|
%h3.event
|
7
|
-
|
7
|
+
- if event.url
|
8
|
+
= link_to event.title, event.url
|
9
|
+
- else
|
10
|
+
= event.title
|
8
11
|
|
9
12
|
%p.date
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
= link_to event.event_venue.title, event.event_venue.url
|
15
|
-
- else
|
16
|
-
at
|
17
|
-
= event.location
|
18
|
-
|
19
|
-
%p.description
|
13
|
+
= event.summarize_period
|
14
|
+
at
|
15
|
+
= link_to event.event_venue.title + '.', event.event_venue.url, :class => 'location'
|
16
|
+
%br
|
20
17
|
= event.short_description
|
@@ -11,8 +11,11 @@
|
|
11
11
|
- remainder = events.slice!(4, 10000)
|
12
12
|
- events.each do |event|
|
13
13
|
%li
|
14
|
-
|
15
|
-
= link_to event.title, event.url
|
14
|
+
- if event.url
|
15
|
+
= link_to event.title, event.url, :class => 'event'
|
16
|
+
- else
|
17
|
+
%span.event
|
18
|
+
= event.title
|
16
19
|
on
|
17
20
|
= event.date
|
18
21
|
- if remainder && remainder.any?
|
@@ -10,29 +10,16 @@ if(typeof jQuery == 'function') {
|
|
10
10
|
|
11
11
|
function build_map_and_markers(element) {
|
12
12
|
if (element != null) {
|
13
|
-
var map = new google.maps.Map(element, {
|
13
|
+
var map = new google.maps.Map(element, {
|
14
|
+
mapTypeId: google.maps.MapTypeId.<%= (Radiant::Config['event_map.googlemap.type'] || 'ROADMAP').upcase %>,
|
15
|
+
mapTypeControlOptions: {
|
16
|
+
style: google.maps.MapTypeControlStyle.<%= (Radiant::Config['event_map.googlemap.controlstyle'] || 'DROPDOWN_MENU').upcase %>
|
17
|
+
}
|
18
|
+
});
|
14
19
|
var bounds = new google.maps.LatLngBounds();
|
15
|
-
var one_icon = new google.maps.MarkerImage('/images/event_calendar/one_event.png',
|
16
|
-
new google.maps.Size(26,45),
|
17
|
-
new google.maps.Point(0,0),
|
18
|
-
new google.maps.Point(7, 45));
|
19
|
-
var several_icon = new google.maps.MarkerImage('/images/event_calendar/several_events.png',
|
20
|
-
new google.maps.Size(26,45),
|
21
|
-
new google.maps.Point(0,0),
|
22
|
-
new google.maps.Point(9, 45));
|
23
|
-
var one_shadow = new google.maps.MarkerImage('/images/event_calendar/event_shadow.png',
|
24
|
-
new google.maps.Size(60, 44),
|
25
|
-
new google.maps.Point(0,0),
|
26
|
-
new google.maps.Point(8, 45));
|
27
|
-
var several_shadow = new google.maps.MarkerImage('/images/event_calendar/event_shadow.png',
|
28
|
-
new google.maps.Size(60, 44),
|
29
|
-
new google.maps.Point(0,0),
|
30
|
-
new google.maps.Point(5, 45));
|
31
20
|
<% venues.each do |venue| %>
|
32
21
|
add_marker(map, {
|
33
22
|
title : "<%= escape_javascript(venue.title) %>",
|
34
|
-
image : <%= events_at_venue(venue).length > 1 ? "several_icon" : "one_icon" %>,
|
35
|
-
shadow : <%= events_at_venue(venue).length > 1 ? "several_shadow" : "one_shadow" %>,
|
36
23
|
position : new google.maps.LatLng("<%= venue.lat %>","<%= venue.lng %>"),
|
37
24
|
description : "<%= escape_javascript(render :partial => 'venue', :object => venue) %>"
|
38
25
|
});
|
data/event_map_extension.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# require_dependency 'application_controller'
|
3
3
|
|
4
4
|
class EventMapExtension < Radiant::Extension
|
5
|
-
version "1.
|
5
|
+
version "1.2.0"
|
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
|
|
@@ -14,6 +14,7 @@ class EventMapExtension < Radiant::Extension
|
|
14
14
|
require 'angle_conversions' # adds String.to_latlng and some degree/radian conversions to Numeric
|
15
15
|
require 'grid_ref' # converts from UK grid references to lat/long
|
16
16
|
EventVenue.send :include, Mappable # adds geolocation on validation
|
17
|
+
Page.send :include, EventMapTags # currently only a very basic events:googlemap tag
|
17
18
|
end
|
18
19
|
|
19
20
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module EventMapTags
|
2
|
+
include Radiant::Taggable
|
3
|
+
include
|
4
|
+
|
5
|
+
class TagError < StandardError; end
|
6
|
+
|
7
|
+
desc %{
|
8
|
+
Drops onto the page a couple of scripts and a div with the id #map_canvas, which between them will
|
9
|
+
present a google map of all your events. To show only one calendar, pass its slug as a calendar attribute:
|
10
|
+
|
11
|
+
<pre><code><r:events:googlemap calendar="slug" /></code></pre>
|
12
|
+
|
13
|
+
}
|
14
|
+
tag 'events:googlemap' do |tag|
|
15
|
+
parameters = {:format => :js}
|
16
|
+
if tag.attr['calendar'] && calendar = Calendar.find_by_slug(tag.attr['calendar'])
|
17
|
+
parameters[:calendar_id] = calendar.id
|
18
|
+
end
|
19
|
+
%{
|
20
|
+
<div id="map_canvas"></div>
|
21
|
+
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
22
|
+
<script type="text/javascript" src="#{eventmap_path(parameters)}"></script>
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
Binary file
|
@@ -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.
|
8
|
+
s.version = "1.2.0"
|
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
|
+
s.date = %q{2010-10-05}
|
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 = [
|
@@ -33,10 +33,12 @@ Gem::Specification.new do |s|
|
|
33
33
|
"features/support/env.rb",
|
34
34
|
"features/support/paths.rb",
|
35
35
|
"lib/angle_conversions.rb",
|
36
|
+
"lib/event_map_tags.rb",
|
36
37
|
"lib/grid_ref.rb",
|
37
38
|
"lib/mappable.rb",
|
38
39
|
"lib/tasks/event_map_extension_tasks.rake",
|
39
40
|
"pkg/radiant-event_map-extension-1.0.1.gem",
|
41
|
+
"pkg/radiant-event_map-extension-1.1.0.gem",
|
40
42
|
"public/images/event_calendar/event_shadow.png",
|
41
43
|
"public/images/event_calendar/one_event.png",
|
42
44
|
"public/images/event_calendar/several_events.png",
|
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:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.2.0
|
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-
|
18
|
+
date: 2010-10-05 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -88,10 +88,12 @@ files:
|
|
88
88
|
- features/support/env.rb
|
89
89
|
- features/support/paths.rb
|
90
90
|
- lib/angle_conversions.rb
|
91
|
+
- lib/event_map_tags.rb
|
91
92
|
- lib/grid_ref.rb
|
92
93
|
- lib/mappable.rb
|
93
94
|
- lib/tasks/event_map_extension_tasks.rake
|
94
95
|
- pkg/radiant-event_map-extension-1.0.1.gem
|
96
|
+
- pkg/radiant-event_map-extension-1.1.0.gem
|
95
97
|
- public/images/event_calendar/event_shadow.png
|
96
98
|
- public/images/event_calendar/one_event.png
|
97
99
|
- public/images/event_calendar/several_events.png
|