Permalink
Browse files

Add event.sessions

  • Loading branch information...
mediafinger committed Apr 1, 2012
1 parent a39ae78 commit ac183761aa9cb578ceb77f95929dd130133b3338
@@ -0,0 +1,12 @@
+require 'edge/events.rb'
+
+class EventSessionsController < ApplicationController
+ def index
+ @sessions = Edge::Events.find_sessions(params[:event_id])
+ end
+
+ def show
+ @session = Edge::Events.find_session(params[:event_id], params[:id])
+ end
+
+end
@@ -0,0 +1,18 @@
+.vertical-spacer
+ .lefty= 'Name: '
+ .righty
+ %h3= @session['name']
+%br
+.lefty= 'Description: '
+.righty= @session['description']
+%br.higher
+.lefty= 'Speaker: '
+.righty= @session['speaker']
+%br.higher
+.lefty= 'url: '
+.righty= @session['url']
+%br.higher
+.lefty= 'Day / Room / Length: '
+.righty= "#{@session['day']} / #{@session['room']} / #{@session['length']}"
+%br
+%hr.short
@@ -0,0 +1,5 @@
+%h2 Sessions
+
+- @sessions.each do |session|
+ - @session = session
+ = render "session"
@@ -0,0 +1 @@
+= render "session"
View
@@ -14,6 +14,7 @@
end
resources :events, :only => [:index, :show] do
+ resources :event_sessions, :as => :sessions, :only => [:index, :show]
resources :ratings, :only => [:index, :show, :edit, :update]
end
match "/events_in", :to => 'events#events_in', :via => :get
View
@@ -6,18 +6,6 @@ def self.find_all
get("/events.json").parsed_response
end
- # Call Events with list of IDs and return list of events
- #
- # def self.find_all_by_id(params[:id_list])
- # params[:id_list].each do |id|
- # get("/events.json/#{id}.json").parsed_response
- # end
- # end
-
- # def get_events_from_ids(*rating_list)
- # Event.find_all_by_id(rating_list.flatten, :select => 'event_id').map(&:id)
- # end
-
def self.find(id)
get("/events/#{id}.json").parsed_response
end
@@ -35,21 +23,34 @@ def self.find_by_country(country)
get("/events.json?country=#{country}").parsed_response
end
- def self.create(attributes)
- attributes = {
- :user_id => current_user.id
- }.merge(attributes)
- post('/events', :body => { :event => attributes })
- end
+ ### Sessions
- def self.find_by_audience(attributes)
- attributes = {
- :audience => 'Fachpublikum',
- }.merge(attributes)
+ def self.find_sessions(event_id)
+ get("/events/#{event_id}/sessions.json").parsed_response
+ end
- get("/events/#{attributes[:event_id]}/do_something.json", :query => attributes)
+ def self.find_session(event_id, id)
+ get("/events/#{event_id}/sessions/#{id}.json").parsed_response
end
+
+ ### More Event stuff
+
+ # def self.create(attributes)
+ # attributes = {
+ # :user_id => current_user.id
+ # }.merge(attributes)
+
+ # post('/events', :body => { :event => attributes })
+ # end
+
+ # def self.find_by_audience(attributes)
+ # attributes = {
+ # :audience => 'Fachpublikum',
+ # }.merge(attributes)
+
+ # get("/events/#{attributes[:event_id]}/do_something.json", :query => attributes)
+ # end
end
end

0 comments on commit ac18376

Please sign in to comment.