Sha256: 6a525dd07b7ed7fc088cfcca0244eeaad7d85c60a92e8f6755f1838d5fa300cd

Contents?: true

Size: 1.19 KB

Versions: 15

Compression:

Stored size: 1.19 KB

Contents

class EventsController < ApplicationController
  include SocialStream::Controllers::Objects

  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 allowed_params
    [
      :start_at, :end_at, :all_day,
      :frequency,
      # Weekly
      :week_days,
      # Monthly
      :week_day_order, :week_day, :interval,
      :room_id
    ]
  end

  def events_with_start_and_end
    @start_time = Time.at(params[:start].to_i)
    @end_time   = Time.at(params[:end].to_i)

    subject = profile_or_current_subject

    @events = Event.followed_by(subject)

    if subject != current_subject
      @events = @events.shared_with(current_subject)
    end

    @events = @events.between(@start_time, @end_time)
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
social_stream-1.1.12 events/app/controllers/events_controller.rb
social_stream-1.1.11 events/app/controllers/events_controller.rb
social_stream-1.1.10 events/app/controllers/events_controller.rb
social_stream-1.1.9 events/app/controllers/events_controller.rb
social_stream-1.1.8 events/app/controllers/events_controller.rb
social_stream-2.0.0.beta1 events/app/controllers/events_controller.rb
social_stream-events-2.0.0.beta1 app/controllers/events_controller.rb
social_stream-1.1.7 events/app/controllers/events_controller.rb
social_stream-1.1.6 events/app/controllers/events_controller.rb
social_stream-1.1.5 events/app/controllers/events_controller.rb
social_stream-1.1.4 events/app/controllers/events_controller.rb
social_stream-1.1.3 events/app/controllers/events_controller.rb
social_stream-1.1.2 events/app/controllers/events_controller.rb
social_stream-1.1.1 events/app/controllers/events_controller.rb
social_stream-events-1.1.1 app/controllers/events_controller.rb