Created
May 7, 2013 05:20
-
-
Save m3talsmith/5530414 to your computer and use it in GitHub Desktop.
fancy calendar fun
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CalendarItem < Section | |
include Mongoid::Document | |
field :url | |
def calendar | |
Icalendar.parse(open(self.url).read).first | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CalendarItemsController < ActionController | |
def create | |
@calendar_item = CalendarItem.create(params[:calendar_item]) | |
redirect_to @calendar_item | |
end | |
def show | |
@calendar_item = CalendarItem.find(params[:id]) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%h1 Fancy Calendar View for #{@calendar_item.url} | |
%h2 Events | |
- @calendar_item.calendar.events.each do |event| | |
%p= event |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment