Sha256: d9cf2ac5fb198b9c9be92bbe07db85af113ddb8d9110a2b13e57fea17ad84653

Contents?: true

Size: 845 Bytes

Versions: 8

Compression:

Stored size: 845 Bytes

Contents

class FollowersController < ApplicationController
  before_filter :authenticate_user!, :except => :index

  respond_to :html, :js

  def index
    @contacts =
      if params[:following]
        current_subject.sent_contacts
      else
        current_subject.received_contacts
      end

    respond_to do |format|
      format.html { @contacts = @contacts.page(params[:page]).per(20) }
      format.js { @contacts = @contacts.page(params[:page]).per(20) }
      format.json { render :text => to_json(@contacts) }
    end
  end

  def update
    current_contact.relation_ids = Array.wrap(Relation::Follow.instance.id)

    respond_to :js
  end

  def destroy
    current_contact.relation_ids = Array.new

    respond_to :js
  end

  private

  def current_contact
    @contact ||=
      current_subject.sent_contacts.find params[:id]
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
social_stream-0.25.1 base/app/controllers/followers_controller.rb
social_stream-base-0.19.1 app/controllers/followers_controller.rb
social_stream-0.25.0 base/app/controllers/followers_controller.rb
social_stream-base-0.19.0 app/controllers/followers_controller.rb
social_stream-0.24.1 base/app/controllers/followers_controller.rb
social_stream-base-0.18.1 app/controllers/followers_controller.rb
social_stream-0.24.0 base/app/controllers/followers_controller.rb
social_stream-base-0.18.0 app/controllers/followers_controller.rb