Sha256: 257486a145b3d0cd1757ad241ded2f0bce7943e573d51ea722108853ccc1eade

Contents?: true

Size: 933 Bytes

Versions: 3

Compression:

Stored size: 933 Bytes

Contents

module TiesHelper
  def tie_brief(tie)
    "N contacts in common"
  end

  # Show current ties from current user to actor, if they exist, or provide a link
  # to create a new tie to actor
  def ties_to(a)
    if user_signed_in?
      if current_subject.ties_to(a).present?
        current_subject.ties_to(a).first.relation_name
      else
        new_tie_link(current_subject.sent_ties.build :receiver_id => Actor.normalize_id(a))
      end
    else
      link_to t("contact.new.link"), new_user_session_path
    end
  end

  def new_tie_link(tie)
    link_to t("contact.new.link"),
            new_tie_path("tie[sender_id]" => tie.sender.id,
                         "tie[receiver_id]" => tie.receiver.id),
            :title => t("contact.new.title",
                        :name => tie.receiver_subject.name),
                        :remote => true
  end

  def link_follow_state
      link_to("Unfollow", home_path)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
social_stream-0.4.2 app/helpers/ties_helper.rb
social_stream-0.4.1 app/helpers/ties_helper.rb
social_stream-0.4.0 app/helpers/ties_helper.rb