Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class ListEventsScreen < PM::TableScreen
title "Upcoming Events"
def on_load
@events = []
load_events
end
def load_events
AFMotion::JSON.get("http://calagator.org/events.json") do |response|
if response.success?
@events = response.object
update_table_data
else
app.alert "Sorry, there was an error while trying to load the events."
end
end
end
def table_data
[{
cells: @events.map do |event|
{ title: event["title"] }
end
}]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment