radiant-event_calendar-extension 1.4.6 → 1.4.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # Event Calendar Extension for Radiant
2
2
 
3
- This extension lets your radiant site present calendar events in various useful ways. The events can be administered directly or retrieved by subscription to ical and caldav services including Google Calendar, and can be served as RSS, Ical or JSON feeds as well as through a broad set of radius tags on your normal pages. This extension supports a wide range of uses from a basic display of forthcoming events through to a full calendar aggregation and mapping service.
3
+ This extension lets your radiant site present calendar events in various useful ways. The events can be administered directly or retrieved by subscription to ical and caldav services including Google Calendar, and can be served as RSS, Ical or JSON feeds as well as through a broad set of radius tags on your normal pages. This extension supports a wide range of uses from a single-tag display of forthcoming events through to a full calendar aggregation and mapping service.
4
4
 
5
5
  The calendaring functionality comes from [ri_cal](http://github.com/rubyredrick/ri_cal) and supports proper recurrence and duration. We also recognise all-day events and pass through notes and urls: the ical subscription and redistribution should be fully RFC2445 compliant. It is not yet a full CalDAV client, and we don't have proper support for principals, groups or availability.
6
6
 
7
- See the [event_map](http://github.com/spanner/radiant-event_map-extension) extension for googlemapping of events and [taggable_events](http://github.com/spanner/radiant-taggable_events-extension) for more fine-grained tagging and retrieval options. A `reader_events` extension is also in the works for reader-submitted calendar events, but [reader](http://github.com/spanner/radiant-reader-extension) will need to be updated for 0.9 first.
7
+ See the [event_map](http://github.com/spanner/radiant-event_map-extension) extension for googlemapping of events and [taggable_events](http://github.com/spanner/radiant-taggable_events-extension) for more fine-grained tagging and retrieval options. A `reader_events` extension is also in the works for public submission of calendar events.
8
8
 
9
9
  ## Requirements
10
10
 
11
- Radiant 0.9, `layouts` or `share_layouts` and the `ri_cal` gem to handle iCal data. It's declared in the extension so this should do it:
11
+ Radiant 0.9 or 1, `layouts` or `share_layouts` and the `ri_cal` gem to handle iCal data. It's declared in the extension so this should do it:
12
12
 
13
13
  sudo rake gems:install
14
14
 
@@ -16,7 +16,7 @@ This is compatible with `multi_site` and with the [sites](http://github.com/span
16
16
 
17
17
  There is a 0.81 tag in the repository for the last version good with radiant 0.8.1 and `scoped_admin`.
18
18
 
19
- This version includes some experiments in dashboard integration. If you're using dashboard you need the spanner fork.
19
+ This version includes some optional experiments in dashboard integration. If you're using dashboard you need the spanner fork.
20
20
 
21
21
  ## Installation
22
22
 
@@ -137,14 +137,12 @@ If you have another column in your layout, try adding this:
137
137
 
138
138
  For clickable thumbnails of coming months.
139
139
 
140
- ## Notes
141
-
142
- This is developing quite quickly at the moment but it's in production use on one big and several small sites. If there are bugs they will be fixed immediately.
143
-
144
140
  ### Compatibility
145
141
 
146
142
  I've tested this with Darwin Calendar Server (on Ubuntu), with Google Calendar and with feeds published from iCal on a mac. It should work just as well with iCal server on OS X Server, and in theory any other CalDav-compliant back end. See http://caldav.calconnect.org/ for more possibilities.
147
143
 
144
+ It should in theory be possible to display a feed from facebook, but I haven't tried it. The 'export events' url is supposed to give an ical-compatible feed that is updated each time you accept or decline an invitation.
145
+
148
146
  ### Connecting to Google Calendar
149
147
 
150
148
  Create a calendar in your Google Calendar account. Call it 'public', or whatever you like, and tick the box marked 'make this calendar public'.
@@ -25,12 +25,28 @@ class EventsController < SiteController
25
25
  render :layout => false
26
26
  }
27
27
  format.ics {
28
- headers["Content-disposition"] = %{attachment; filename="#{filename}.ics"}
29
- render :layout => false
28
+ ical = RiCal.Calendar do |cal|
29
+ events.each { |event| cal.add_subcomponent(event.to_ri_cal) }
30
+ end
31
+ send_data ical, :filename => "#{filename}.ics"
30
32
  }
31
33
  end
32
34
  end
33
35
 
36
+ def show
37
+ @event = Event.find(params[:id])
38
+ format.html {
39
+ timeout = Radiant::Config['event_calendar:cache_duration'] || self.class.cache_timeout || 1.hour
40
+ expires_in timeout.to_i, :public => true, :private => false
41
+ }
42
+ format.ics {
43
+ ical = RiCal.Calendar { |cal| cal.add_subcomponent(@event.to_ri_cal) }
44
+ send_data ical, :filename => "#{@event.title.slugify}.ics"
45
+ }
46
+ end
47
+
48
+ ### helper methods
49
+
34
50
  def period
35
51
  return @period if @period
36
52
  this = Date.today
data/app/models/event.rb CHANGED
@@ -281,6 +281,10 @@ class Event < ActiveRecord::Base
281
281
  end
282
282
  end
283
283
 
284
+ def facebook_url
285
+ %{}
286
+ end
287
+
284
288
  def one_day?
285
289
  all_day? && within_day?
286
290
  end
@@ -361,21 +365,10 @@ class Event < ActiveRecord::Base
361
365
  def self.create_from(cal_event)
362
366
  event = new({
363
367
  :uuid => cal_event.uid,
364
- :title => cal_event.summary,
365
- :description => cal_event.description,
366
- :url => cal_event.url,
367
- :start_date => cal_event.dtstart,
368
- :end_date => cal_event.dtend,
369
- :all_day => !cal_event.dtstart.is_a?(DateTime),
370
- :created_at => cal_event.dtstamp
368
+ :created_at => cal_event.dtstamp,
369
+ :status_id => Status[:imported]
371
370
  })
372
- event.status = Status[:imported]
373
- event.set_venue_from_location(cal_event.location)
374
- cal_event.rrule.each { |rule| event.add_recurrence(rule) }
375
- event
376
- rescue => error
377
- logger.error "Event import error: #{error}."
378
- raise
371
+ event.update_from(cal_event)
379
372
  end
380
373
 
381
374
  def update_from(cal_event)
@@ -388,22 +381,17 @@ class Event < ActiveRecord::Base
388
381
  :end_date => cal_event.dtend,
389
382
  :all_day => !cal_event.dtstart.is_a?(DateTime)
390
383
  })
391
- self.status = Status[:imported]
392
- self.set_venue_from_location(cal_event.location)
384
+ unless self.event_venue = EventVenue.find_by_title(cal_event.location)
385
+ self.location = cal_event.location
386
+ end
393
387
  cal_event.rrule.each { |rule| self.add_recurrence(rule) }
394
388
  self.save!
395
389
  self
396
390
  rescue => error
397
- logger.error "Event update error: #{error}."
391
+ Rails.logger.error "Event import error: #{error}."
398
392
  raise
399
393
  end
400
394
 
401
- def set_venue_from_location(location='')
402
- unless location.blank?
403
- self.event_venue = EventVenue.find_by_title(location) || EventVenue.find_or_create_by_location(location)
404
- end
405
- end
406
-
407
395
  protected
408
396
 
409
397
  def set_uuid
@@ -97,7 +97,7 @@ class EventCalendarPage < Page
97
97
 
98
98
  desc %{
99
99
  Renders a trail of breadcrumbs to the current page. On an event calendar page this tag is
100
- overridden to show the filters applied to calendar data (including category, slug and date rage)
100
+ overridden to show the filters applied to calendar data (including category, slug and date range)
101
101
  as well as the path to this page.
102
102
 
103
103
  *Usage:*
@@ -85,6 +85,10 @@
85
85
  = f.label :url, t('event_admin.form.event_url')
86
86
  = f.text_field :url, :class => 'textbox', :disabled => imported
87
87
 
88
+ %p.facebook
89
+ = f.label :facebook_id, t('event_admin.form.facebook_id')
90
+ = f.text_field :facebook_id, :class => 'textbox', :disabled => imported
91
+
88
92
  - form_bottom.edit_venue do
89
93
  - toggle_precedence = %w{venue new_venue}
90
94
  - toggle_precedence.reverse! if @venues.empty?
@@ -33,6 +33,8 @@
33
33
  - elsif event.location
34
34
  %span.location
35
35
  = event.location
36
+ - if event.facebook_id
37
+ = link_to t('event_calendar_extension.view_on_facebook'), event.facebook_url, :class => 'facebook event'
36
38
  - unless repeating
37
39
  = event.description_paragraph
38
40
 
@@ -0,0 +1,21 @@
1
+ - content_for :events do
2
+ = render :partial => 'event', :collection => events
3
+
4
+ - content_for :calendar do
5
+ #calendar
6
+ = render :partial => "events/minicalendar", :locals => {:date => period ? period.start : Date.today}
7
+
8
+ - content_for :title do
9
+ = @event.title
10
+
11
+ - content_for :event do
12
+ = render :partial => 'event', :object => @event
13
+
14
+ - content_for :facebook_id do
15
+ = @event.facebook_id
16
+
17
+ - content_for :facebook_url do
18
+ = event.facebook_url
19
+
20
+ #events
21
+ = yield :event
@@ -26,6 +26,11 @@ en:
26
26
  calendar_short_month: "%b"
27
27
  calendar_day_name: "%A"
28
28
  calendar_day_of_month: "%d"
29
+ event_calendar_extension:
30
+ view_on_facebook: "view on facebook"
31
+ attend_on_facebook: "attend on facebook"
32
+
33
+ # all this is going to be moved into the more conventional activerecord and event_calendar_extension namespaces when I get a chance.
29
34
  refresh_calendar: "refresh calendar"
30
35
  edit_calendar: "edit calendar"
31
36
  delete_calendar: "delete calendar"
@@ -102,6 +107,7 @@ en:
102
107
  no_events: No events to display
103
108
  show_all: (show all)
104
109
  events: Events
110
+ many_times: many times
105
111
  new:
106
112
  title: New calendar
107
113
  header: New Calendar
@@ -118,6 +124,7 @@ en:
118
124
  start: Start date and time
119
125
  end: end date and time
120
126
  event_url: Event url
127
+ facebook_id: Facebook event id
121
128
  repeat_note: (this is for separate similar events. For events that span several days you only need to set the start and end.)
122
129
  calendar_note: This is optional but can be used to file your events or to mix local events into a subscribed calendar.
123
130
  all_day: All-day event?
@@ -154,13 +161,13 @@ en:
154
161
  form:
155
162
  title: Venue or location title
156
163
  choose: choose an existing place
157
- choose_note: We remember these details for you, so changes here affect every event occurring in this place
158
- choose_list: choose it from the list
159
- choose_before: If you've used this place before, please
160
- choose_after: so that you can update it globally
164
+ choose_note: "We remember these details for you, so changes here affect every event occurring in this place"
165
+ choose_list: "choose it from the list"
166
+ choose_before: "If you've used this place before, please"
167
+ choose_after: "so that you can update it globally"
161
168
  keywords: Keywords
162
169
  location_tag: Location tag
163
- location_tag_note: This is used to recognise the venue in a calendar feed. It can be postcode, grid reference or any distinctive string.
170
+ location_tag_note: "If your address is very specific or difficult to locate, you can enter a postcode, grid reference or lat/long pair here."
164
171
  address: Address or directions
165
172
  postcode: Postcode or grid reference
166
173
  postcode_note: This is only required if your address is unusual or you want these events to show on a map in a particular place.
data/config/routes.rb CHANGED
@@ -6,6 +6,8 @@ ActionController::Routing::Routes.draw do |map|
6
6
  cal.resources :event_venues, :member => {:remove => :get}, :has_many => :events
7
7
  cal.calendars_home '/', :controller => 'events', :action => 'index'
8
8
  end
9
+
10
+ map.calendar "/calendar/events/:id.:format", :controller => 'events', :action => 'show'
9
11
  map.calendar "/calendar.:format", :controller => 'events', :action => 'index'
10
12
  map.calendar_year "/calendar/:year", :controller => 'events', :action => 'index'
11
13
  map.calendar_month "/calendar/:year/:month", :controller => 'events', :action => 'index'
@@ -0,0 +1,9 @@
1
+ class Facebook < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :events, :facebook_id, :string
4
+ end
5
+
6
+ def self.down
7
+ remove_column :events, :facebook_id
8
+ end
9
+ end
@@ -424,7 +424,7 @@ module EventCalendarTags
424
424
  end
425
425
  end
426
426
 
427
- [:id, :title, :description, :short_description, :location, :url].each do |attribute|
427
+ [:id, :title, :description, :short_description, :location, :url, :facebook_id].each do |attribute|
428
428
  desc %{
429
429
  Renders the #{attribute} attribute of the current event.
430
430
 
@@ -455,8 +455,18 @@ module EventCalendarTags
455
455
  tag.expand unless tag.locals.event.send(attribute)
456
456
  end
457
457
  end
458
+
459
+ desc %{
460
+ Renders the url of the facebook event corresponding to this event, if there is one.
461
+
462
+ Usage:
463
+ <pre><code><r:facebook_url /></code></pre>
464
+ }
465
+ tag "event:facebook_url" do |tag|
466
+ tag.locals.event.facebook_url
467
+ end
458
468
 
459
- #todo: venue:* tags
469
+ #todo: venues:* tags
460
470
 
461
471
  desc %{
462
472
  Renders a sensible location string, based on whatever venue information is available.
@@ -1,5 +1,5 @@
1
1
  module RadiantEventCalendarExtension
2
- VERSION = '1.4.6'
2
+ VERSION = '1.4.7'
3
3
  SUMMARY = %Q{Event Calendar Extension for Radiant CMS}
4
4
  DESCRIPTION = "An event calendar extension that administers events locally or draws them from any ical or CalDAV publishers (Google Calendar, .Mac, Darwin Calendar Server, etc.)"
5
5
  URL = "http://github.com/radiant/radiant-event_calendar-extension"
@@ -31,6 +31,7 @@ $text: $coolgrey11
31
31
  $hover: $red
32
32
  $tag: $coolgrey8
33
33
  $input: $coolgrey11
34
+ $link: $red
34
35
 
35
36
  =inputfonts
36
37
  font-family: Georgia, serif
@@ -43,73 +44,73 @@ $input: $coolgrey11
43
44
  =blurred($color: $paler)
44
45
  text-shadow: $color 0 0 2px
45
46
 
46
- /*** calendars and maps *******
47
+ /** calendars and maps *******
47
48
 
48
49
  #events
49
50
  .event
50
- :position relative
51
- :margin-bottom 20px
51
+ position: relative
52
+ margin-bottom: 20px
52
53
  .dateholder
53
- :position absolute
54
- :left 15px
55
- :top 2px
56
- :padding 5px 5px 0 5px
57
- :border 0
54
+ position: absolute
55
+ left: 15px
56
+ top: 2px
57
+ padding: 5px 5px 0 5px
58
+ border: 0
58
59
  +functionalfonts
59
- :text-align center
60
- :line-height 1.05
61
- :background-color = !page
62
- :border
63
- :style solid
64
- :width 1px
65
- :color = !verypale
66
- span.month, span.dow
67
- :display block
68
- :font-weight lighter
69
- :font-size 80%
70
- :text-transform uppercase
60
+ text-align: center
61
+ line-height: 1.05
62
+ background-color: white
63
+ border:
64
+ style: solid
65
+ width: 1px
66
+ color: #d6d6d4
67
+ span.month, span.dow
68
+ display: block
69
+ font-weight: lighter
70
+ font-size: 80%
71
+ text-transform: uppercase
71
72
  span.day, span.dom
72
- :display block
73
- :font-weight bold
74
- :font-size 160%
73
+ display: block
74
+ font-weight: bold
75
+ font-size: 160%
75
76
  .detail
76
77
  h3
77
- :margin 0
78
- :font-size 180%
79
- p
80
- :margin-top 0
81
- :font-size 90%
82
- :line-height 1.4
83
- p.venue
84
- :font-style italic
85
- :margin-bottom 6px
86
- p.description
87
- :margin-bottom 16px
78
+ margin: 0
79
+ font-size: 180%
80
+ p
81
+ margin-top: 0
82
+ font-size: 90%
83
+ line-height: 1.4
84
+ p.venue
85
+ font-style: italic
86
+ margin-bottom: 6px
87
+ p.description
88
+ margin-bottom: 16px
88
89
 
89
90
  #continuing
90
91
  h3
91
92
  +functionalfonts
92
- :font-weight bold
93
- :font-size 1.2em
94
- :margin-bottom 0
93
+ font-weight: bold
94
+ font-size: 1.2em
95
+ margin-bottom: 0
95
96
  ul
96
97
  +functionalfonts
97
- :font-size 90%
98
- :line-height 1.2
99
- :padding-left 0
98
+ font-size: 90%
99
+ line-height: 1.2
100
+ padding-left: 0
100
101
  li
101
- :margin-top 10px
102
- :font-style normal
102
+ margin-top: 10px
103
+ font-style: normal
103
104
  a.title
104
- :font-weight bold
105
+ font-weight: bold
105
106
  span.detail
106
- :font-size 80%
107
+ font-size: 80%
107
108
 
108
- #faceting
109
+ #faceting
109
110
  a.defilter
110
- :padding-left 14px
111
- :background transparent url(/images/furniture/detag.png) no-repeat top left
112
- :color #c00
111
+ padding-left: 14px
112
+ background: transparent url(/images/furniture/detag.png) no-repeat top left
113
+ color: #cc0000
113
114
 
114
115
  table.minimonth
115
116
  font-style: normal
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-event_calendar-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 6
10
- version: 1.4.6
9
+ - 7
10
+ version: 1.4.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Loren Johnson
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-07-14 00:00:00 +01:00
20
+ date: 2011-07-18 00:00:00 +01:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -131,8 +131,8 @@ files:
131
131
  - app/views/events/_other_page_parts.html.haml
132
132
  - app/views/events/_views.html.haml
133
133
  - app/views/events/index.html.haml
134
- - app/views/events/index.ics.erb
135
134
  - app/views/events/index.rss.builder
135
+ - app/views/events/show.html.haml
136
136
  - config/initializers/radiant_config.rb
137
137
  - config/locales/de.yml
138
138
  - config/locales/en.yml
@@ -159,6 +159,7 @@ files:
159
159
  - db/migrate/20100222182112_occurrences.rb
160
160
  - db/migrate/20100927140126_amended_events.rb
161
161
  - db/migrate/20100927203940_calendar_keywords.rb
162
+ - db/migrate/20110717171550_facebook.rb
162
163
  - event_calendar_extension.rb
163
164
  - lib/calendar_period.rb
164
165
  - lib/event_calendar_admin_ui.rb
@@ -177,7 +178,6 @@ files:
177
178
  - public/stylesheets/sass/admin/event_calendar.sass
178
179
  - public/stylesheets/sass/admin/event_calendar_dashboard.sass
179
180
  - public/stylesheets/sass/event_calendar.sass
180
- - radiant-event_calendar-extension-1.4.5.gem
181
181
  - radiant-event_calendar-extension.gemspec
182
182
  - Rakefile
183
183
  - README.md
@@ -199,7 +199,7 @@ has_rdoc: true
199
199
  homepage: http://github.com/radiant/radiant-event_calendar-extension
200
200
  licenses: []
201
201
 
202
- post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-event_calendar-extension', :version => '~> 1.4.6'\n\n "
202
+ post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-event_calendar-extension', :version => '~> 1.4.7'\n\n "
203
203
  rdoc_options: []
204
204
 
205
205
  require_paths:
@@ -1,7 +0,0 @@
1
- <%-
2
- ical = RiCal.Calendar do |cal|
3
- events.each do |event|
4
- cal.add_subcomponent(event.to_ri_cal) if event.master?
5
- end
6
- end
7
- %><%= ical.to_s %>