Find file
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (45 sloc) 3.06 KB
= Page Event
Created by Marty Haught, January 2008
Page Event is a simple page-based event calendar for associating time-based events with your Radiant pages. The original example was setting up meeting announcements in radiant where the meeting was a page. Having this meeting show up on a site-wide calendar and having exact information on when the meeting was taking place was important.
NOTE: This assumes you're on 0.8.1. It most likely will not be backwards compatible with older versions of Radiant. If you need to make this work with an older version then I'd suggest you look at an older version of the extension.
1) Install the Calendar Date Select plugin
# install the gem
sudo gem install calendar_date_select
# add gem dependency to environment.rb
config.gem "calendar_date_select"
# though optional, I recommend unpacking the gem
rake gems:unpack
You can read more about it here:
2) Install the Page Event Extension
script/extension install page_event
git clone git:// vendor/extensions/page_event
3) run migration*
rake production radiant:extensions:page_event:migrate
4) run rake update for extension*
rake radiant:extensions:page_event:update
* Both 3 and 4 are unnecessary if you used the script/extension install command
5) Start (or restart) your server
The extension will create a new column on the pages table to store an optional event timestamp. The admin create/edit page interface will now have an Event Date field with pop-up calendar widget that will allow you to set a date and time that represents an event. This page will now be associated with that time. Additionally, there is a page event admin tab next to pages tab that will give you a month's view of events. It also have next and previous month navigation. The current UI is basic so look forward to it being enhanced.
For displaying these events on your radiant pages you can choose from several tags. The main tag you'll use is the monthly calendar tag:
<r:events:calendar />
It will produce the current month's view with any events during the time. The calendar also has previous and next month navigation. A default set of css styles are provided in the following file:
In order to make use of this stylesheet you'll need to add it to the pages that will use the calendar tag.
There are several tags that allow you to grab either the next event or a list of upcoming events.
When it comes to accessing a specific page's event data you can use the following tags:
Date: <r:date />
Time: <r:time />
Duration: <r:duration />
<r:event:date />
<r:event:time />
<r:event:duration />
They will simply output the date or time, respectively, in a human formatted version. The <r:date/> and <r:time/> tags accept a format attribute that specifies a strftime pattern for formatting the date or time.