radiant-event_calendar-extension 1.5.1 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -65,44 +65,9 @@ Should be obvious. There are a few points to remember:
65
65
  * Recurrence is for the repetition of identical separate events. A single event that spans several days only needs to have the right start and end times.
66
66
  * End times are optional: an event with just a start time is just listed where it begins.
67
67
 
68
- ### Displaying events with the EventsController
69
-
70
- The events controller uses `share_layouts` to define various page parts that your layout can bring in. To use it, create a layout with any or all of these parts:
71
-
72
- * `title` is the page title and can also be shown with `r:title`
73
- * `events` is a formatted list of events with date stamps and descriptions
74
- * `continuing_events` is a compact list of events that have already begun but which continue into the period being shown
75
- * `calendar` is a usual calendar block with links to months and days. Days without events are not linked.
76
- * `pagination` is the usual will_paginate block.
77
- * `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.
78
-
79
- Set the config entry `event_calendar.layout` to the name of your layout and point a browser at /calendar to see what you've got.
80
-
81
- Here's a basic sample layout that should just work:
82
-
83
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
84
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
85
-
86
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
87
- <head>
88
- <title><r:title /></title>
89
- <link rel="stylesheet" href="/stylesheets/event_calendar.css" />
90
- </head>
91
- <body>
92
- <h1 id="pagetitle"><r:title /></h1>
93
- <r:content part="faceting" />
94
- <r:content part="calendar" />
95
- <r:content part="events" />
96
- <r:content part="continuing_events" />
97
- <r:content part="pagination" />
98
- </body>
99
- </html>
100
-
101
- One quirk that might go away: at the moment if there are few new events then the continuing events are moved into the events page part. Most layouts work better that way.
102
-
103
68
  ### Displaying events with an EventCalendar page
104
69
 
105
- Set up a new page at /events/ with the type 'EventCalendar'. To show a pageable calendar view of the current month, all you need is this:
70
+ This is the preferred method. Set up a new page at /events/ with the type 'EventCalendar'. To show a pageable calendar view of the current month, all you need is this:
106
71
 
107
72
  <r:events:as_calendar month="now" month_links="true" />
108
73
 
@@ -139,6 +104,43 @@ If you have another column in your layout, try adding this:
139
104
 
140
105
  For clickable thumbnails of coming months.
141
106
 
107
+ ### Displaying events with the EventsController
108
+
109
+ I think I'm going to deprecate this use some time soon: it's too hard to adapt to local circumstances. For now it still works:
110
+
111
+ The events controller uses `share_layouts` to define various page parts that your layout can bring in. To use it, create a layout with any or all of these parts.
112
+
113
+ * `title` is the page title and can also be shown with `r:title`
114
+ * `events` is a formatted list of events with date stamps and descriptions
115
+ * `continuing_events` is a compact list of events that have already begun but which continue into the period being shown
116
+ * `calendar` is a usual calendar block with links to months and days. Days without events are not linked.
117
+ * `pagination` is the usual will_paginate block.
118
+ * `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.
119
+
120
+ Set the config entry `event_calendar.layout` to the name of your layout and point a browser at /calendar to see what you've got.
121
+
122
+ Here's a basic sample layout that should just work:
123
+
124
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
125
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
126
+
127
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
128
+ <head>
129
+ <title><r:title /></title>
130
+ <link rel="stylesheet" href="/stylesheets/event_calendar.css" />
131
+ </head>
132
+ <body>
133
+ <h1 id="pagetitle"><r:title /></h1>
134
+ <r:content part="faceting" />
135
+ <r:content part="calendar" />
136
+ <r:content part="events" />
137
+ <r:content part="continuing_events" />
138
+ <r:content part="pagination" />
139
+ </body>
140
+ </html>
141
+
142
+ One quirk that might go away: at the moment if there are few new events then the continuing events are moved into the events page part. Most layouts work better that way.
143
+
142
144
  ### Compatibility
143
145
 
144
146
  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.
@@ -1,5 +1,6 @@
1
1
  class EventsController < SiteController
2
2
  require "uri"
3
+ require "ri_cal"
3
4
  include Radiant::Pagination::Controller
4
5
 
5
6
  helper_method :events, :all_events, :continuing_events, :period, :calendars, :list_description
@@ -191,6 +191,10 @@ class Event < ActiveRecord::Base
191
191
  I18n.l start_date, :format => :calendar_day_name
192
192
  end
193
193
 
194
+ def short_day
195
+ I18n.l start_date, :format => :calendar_short_day
196
+ end
197
+
194
198
  def mday
195
199
  I18n.l start_date, :format => :calendar_day_of_month
196
200
  end
@@ -5,9 +5,12 @@
5
5
  - event_master_id = event.master_id || event.id
6
6
  - repeating = true if @seen_events[event_master_id]
7
7
  - @seen_events[event_master_id] = true;
8
- - cssclass = event.calendar ? "event #{event.calendar.slug}" : "event"
8
+ - cssclasses = ['event']
9
+ - cssclasses << 'repeat' if repeating
10
+ - cssclasses << event.calendar.slug if event.calendar
9
11
 
10
- %div{:class => cssclass}
12
+
13
+ %div{:class => cssclasses.join(' ')}
11
14
  - unless no_date
12
15
  .datemark
13
16
  .mon= event.short_month
@@ -1,6 +1,6 @@
1
1
  Radiant.config do |config|
2
2
  config.namespace('event_calendar') do |calendar|
3
- calendar.define 'path', :default => "/calendar", :allow_blank => false
3
+ calendar.define 'path', :default => "cal", :allow_blank => false
4
4
  calendar.define 'icals_path', :default => "/icals", :allow_blank => false
5
5
  calendar.define 'cache_duration', :type => :integer, :default => 3600, :units => 'seconds'
6
6
  calendar.define 'refresh_interval', :type => :integer, :default => 3600, :units => 'seconds'
@@ -17,6 +17,7 @@ en:
17
17
  calendar_period_minicalendar_title: "%B %Y"
18
18
  calendar_period_minicalendar_month: "%B"
19
19
  calendar_month: "%B"
20
+ calendar_short_day: "%a"
20
21
  calendar_short_month: "%b"
21
22
  calendar_day_name: "%A"
22
23
  calendar_day_of_month: "%d"
@@ -7,7 +7,8 @@ ActionController::Routing::Routes.draw do |map|
7
7
  cal.calendars_home '/', :controller => 'events', :action => 'index'
8
8
  end
9
9
 
10
- calendar_prefix = Radiant.config['event_calendar.path'] || "/calendar"
10
+ calendar_prefix = Radiant.config['event_calendar.path'] || "cal"
11
+ calendar_prefix = nil if calendar_prefix.blank?
11
12
  map.resources :events, :path_prefix => calendar_prefix, :only => [:index, :show]
12
13
  map.calendar "#{calendar_prefix}.:format", :controller => 'events', :action => 'index'
13
14
  map.calendar_year "#{calendar_prefix}/:year", :controller => 'events', :action => 'index'
@@ -359,43 +359,6 @@ module EventCalendarTags
359
359
  %{<a href="#{tag.render('calendar:url')}#{anchor}"#{attributes}>#{text}</a>}
360
360
  end
361
361
 
362
- desc %{
363
- Renders the path to the local .ics file for this calendar, suitable for read-only subscription in iCal or other calendar programs.
364
-
365
- Usage:
366
- <pre><code><r:calendar:ical_url /></code></pre>
367
- }
368
- tag "calendar:ical_url" do |tag|
369
- tag.locals.calendar.to_ics
370
- end
371
-
372
- desc %{
373
- Renders a link to the local .ics file for this calendar, suitable for read-only subscription in iCal or other calendar programs.
374
- Link attributes are passed through as usual.
375
-
376
- Usage:
377
- <pre><code><r:calendar:ical_link /></code></pre>
378
- }
379
- tag "calendar:ical_link" do |tag|
380
- options = tag.attr.dup
381
- anchor = options['anchor'] ? "##{options.delete('anchor')}" : ''
382
- attributes = options.inject('') { |s, (k, v)| s << %{#{k.downcase}="#{v}" } }.strip
383
- attributes = " #{attributes}" unless attributes.empty?
384
- text = tag.double? ? tag.expand : tag.render('calendar:name')
385
- %{<a href="#{tag.render('calendar:ical_url')}#{anchor}"#{attributes}>#{text}</a>}
386
- end
387
-
388
- desc %{
389
- Renders a small graphical link to the local .ics file for this calendar.
390
-
391
- Usage:
392
- <pre><code><r:calendar:ical_icon /></code></pre>
393
- }
394
- tag "calendar:ical_icon" do |tag|
395
- text = tag.attr['text'] || ''
396
- %{<a href="#{tag.render('calendar:ical_url')}" class="ical"><img src="/images/event_calendar/ical16.png" alt="subscribe to #{tag.render('calendar:name')}" width="16" height="16" /> #{text}</a>}
397
- end
398
-
399
362
  #### Event:* tags
400
363
  #### display attributes of a single event
401
364
 
@@ -426,7 +389,7 @@ module EventCalendarTags
426
389
  end
427
390
  end
428
391
 
429
- [:id, :title, :description, :short_description, :location, :url, :facebook_id].each do |attribute|
392
+ [:id, :title, :description, :short_description, :location, :url, :facebook_id, :facebook_url].each do |attribute|
430
393
  desc %{
431
394
  Renders the #{attribute} attribute of the current event.
432
395
 
@@ -459,13 +422,16 @@ module EventCalendarTags
459
422
  end
460
423
 
461
424
  desc %{
462
- Renders the url of the facebook event corresponding to this event, if there is one.
463
-
464
- Usage:
465
- <pre><code><r:facebook_url /></code></pre>
425
+ Sets the active calendar to that of the present event, if any.
466
426
  }
467
- tag "event:facebook_url" do |tag|
468
- tag.locals.event.facebook_url
427
+ tag "event:calendar" do |tag|
428
+ if tag.locals.calendar = tag.locals.event.calendar
429
+ if tag.double?
430
+ tag.expand
431
+ else
432
+ tag.locals.calendar.name
433
+ end
434
+ end
469
435
  end
470
436
 
471
437
  desc %{
@@ -497,6 +463,7 @@ module EventCalendarTags
497
463
  tag "event:facebook_link" do |tag|
498
464
  if tag.locals.event.facebook_id
499
465
  options = tag.attr.dup
466
+ options['class'] ||= 'facebook event'
500
467
  options['title'] ||= I18n.t('event_calendar_extension.view_on_facebook')
501
468
  attributes = options.inject('') { |s, (k, v)| s << %{#{k.downcase}="#{v}" } }.strip
502
469
  attributes = " #{attributes}" unless attributes.empty?
@@ -546,8 +513,34 @@ module EventCalendarTags
546
513
  text = tag.double? ? tag.expand : I18n.t('event_calendar_extension.tweet_this')
547
514
  %{<a href="#{twitter_url}"#{attributes}>#{text}</a>}
548
515
  end
516
+
517
+ desc %{
518
+ Renders the path to the local .ics file for this calendar, suitable for read-only subscription in iCal or other calendar programs.
519
+
520
+ Usage:
521
+ <pre><code><r:calendar:ical_url /></code></pre>
522
+ }
523
+ tag "calendar:ical_url" do |tag|
524
+ tag.locals.calendar.to_ics
525
+ end
526
+
527
+ desc %{
528
+ Renders a link to the ical representation of this event, which should drop the event into
529
+ a user's desktop calendar. Link attributes are passed through as usual.
549
530
 
550
- #todo: venues:* tags
531
+ Usage:
532
+ <pre><code><r:event:ical_link class="ical event" /></code></pre>
533
+ }
534
+ tag "event:ical_link" do |tag|
535
+ options = tag.attr.dup
536
+ options['title'] ||= I18n.t('event_calendar_extension.download_event')
537
+ options['class'] ||= 'ical download'
538
+ attributes = options.inject('') { |s, (k, v)| s << %{#{k.downcase}="#{v}" } }.strip
539
+ text = tag.double? ? tag.expand : I18n.t('event_calendar_extension.tweet_this')
540
+ %{<a href="#{event_path(tag.locals.event, :format => 'ics')}" #{attributes}>#{text}</a>}
541
+ end
542
+
543
+ #TODO: venues:* tags
551
544
 
552
545
  desc %{
553
546
  Renders a sensible location string, based on whatever venue information is available.
@@ -800,15 +793,12 @@ module EventCalendarTags
800
793
  <pre><code><r:event:datemark /></code></pre>
801
794
  }
802
795
  tag "event:datemark" do |tag|
803
- html = ""
804
- html << _datemark(tag.locals.event.start_date)
805
- html
806
- end
807
-
808
- def _datemark(date=Time.now)
809
796
  %{
810
- <div class="datemark"><span class="mon">#{Date::ABBR_MONTHNAMES[date.month]}</span><span class="dom">#{"%02d" % date.mday}</span></div>
811
- }
797
+ <div class="datemark">
798
+ <span class="dow">#{tag.locals.event.short_day}</span>
799
+ <span class="dom">#{tag.locals.event.mday}</span>
800
+ </div>
801
+ }
812
802
  end
813
803
 
814
804
  desc %{
@@ -818,7 +808,6 @@ module EventCalendarTags
818
808
 
819
809
  Usage:
820
810
  <pre><code><r:events:minimonth [year=""] [month=""] /></code></pre>
821
-
822
811
  }
823
812
  tag "events:minimonth" do |tag|
824
813
  attr = parse_boolean_attributes(tag)
@@ -1,5 +1,5 @@
1
1
  module RadiantEventCalendarExtension
2
- VERSION = '1.5.1'
2
+ VERSION = '1.5.3'
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"
@@ -12,12 +12,12 @@ describe EventCalendarPage do
12
12
  end
13
13
 
14
14
  describe ".find_by_url" do
15
- it "should return self to our own url" do
16
- pages(:calendar).find_by_url("/#{pages(:calendar).slug}/").should == pages(:calendar)
15
+ it "should return self to our own path" do
16
+ pages(:calendar).find_by_path("/#{pages(:calendar).slug}/").should == pages(:calendar)
17
17
  end
18
18
 
19
- it "should return self to any child url" do
20
- pages(:calendar).find_by_url("/#{pages(:calendar).slug}/something").should == pages(:calendar)
19
+ it "should return self to any child path" do
20
+ pages(:calendar).find_by_path("/#{pages(:calendar).slug}/something").should == pages(:calendar)
21
21
  end
22
22
  end
23
23
 
@@ -9,10 +9,9 @@ describe EventCalendarTags do
9
9
  context "rendering event: tags" do
10
10
  before do
11
11
  Radiant.config['site.host'] = "test.host"
12
- Radiant.config['event_calendar.path'] = "/test_calendar"
13
12
  end
14
13
 
15
- [:id, :title, :description, :short_description, :location, :url, :facebook_id].each do |tag|
14
+ [:id, :title, :description, :short_description, :location, :url, :facebook_id, :facebook_url].each do |tag|
16
15
  it "event:#{tag}" do
17
16
  page.should render(%{<r:event id="#{event.id}"><r:event:#{tag} /></r:event>}).as( event.send(tag.to_sym).to_s )
18
17
  end
@@ -20,7 +19,7 @@ describe EventCalendarTags do
20
19
 
21
20
  it "event:ical_link" do
22
21
  page.should render(%{<r:event id="#{event.id}"><r:event:ical_link class="ical">I</r:event:ical_link></r:event>}).as(
23
- %{<a href="/test_calendar/events/#{event.id}.ics" title="Download event" class="ical">I</a>}
22
+ %{<a href="/cal/events/#{event.id}.ics" title="Download event" class="ical">I</a>}
24
23
  )
25
24
  end
26
25
 
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: 1
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 1
10
- version: 1.5.1
9
+ - 3
10
+ version: 1.5.3
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-09-14 00:00:00 Z
20
+ date: 2011-10-05 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: ri_cal
@@ -182,7 +182,6 @@ files:
182
182
  - public/stylesheets/sass/admin/event_calendar.sass
183
183
  - public/stylesheets/sass/admin/event_calendar_dashboard.sass
184
184
  - public/stylesheets/sass/event_calendar.sass
185
- - radiant-event_calendar-extension-1.5.0.gem
186
185
  - radiant-event_calendar-extension.gemspec
187
186
  - Rakefile
188
187
  - README.md
@@ -204,7 +203,7 @@ files:
204
203
  homepage: http://github.com/radiant/radiant-event_calendar-extension
205
204
  licenses: []
206
205
 
207
- post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-event_calendar-extension', :version => '~> 1.5.1'\n\n "
206
+ post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-event_calendar-extension', :version => '~> 1.5.3'\n\n "
208
207
  rdoc_options: []
209
208
 
210
209
  require_paths: