Sha256: b60280add18c9ecdd0fb945688c59e02840a66979ffd062ee759797025cc96f2
Contents?: true
Size: 1.15 KB
Versions: 13
Compression:
Stored size: 1.15 KB
Contents
class EventsController < ApplicationController include SocialStream::Controllers::Objects belongs_to_subjects :optional => true before_filter :profile_subject!, :only => :index def index index! do |format| format.js { events_with_start_and_end } format.json { events_with_start_and_end render :json => @events. map{ |e| e.to_json(:start => @start_time, :end => @end_time) }.flatten.to_json } end end def show show! do |format| format.html { redirect_to polymorphic_path([ @event.post_activity.receiver_subject, Event.new ], :at => @event.start_at.to_i) } end end private def collection @activities = profile_subject.wall(:profile, :for => current_subject, :object_type => :Event) end def events_with_start_and_end @start_time = Time.at(params[:start].to_i) @end_time = Time.at(params[:end].to_i) @activities = collection. joins(:activity_objects => :event). merge(Event.between(@start_time, @end_time)) @events = @activities.map(&:direct_object) end end
Version data entries
13 entries across 13 versions & 2 rubygems