Sha256: ce2a65d2e2256ac8efd7329a7869532c49505c3b629733f4e65316879e049158

Contents?: true

Size: 719 Bytes

Versions: 4

Compression:

Stored size: 719 Bytes

Contents

# Helper methods that deal with the display of user information.
# origin: M
module UserHelper

  def friendship_status(user, only_image = false)
    icon, title = if current_user == user
      [ 'icons/user-red.png', 'This is you' ]
    elsif current_user.friends_with?(user)
      [ 'icons/user-medium.png', 'Confirmed contact' ]
    elsif current_user.in_contact_with?(user)
      [ 'icons/mail.png', 'Contact request sent' ]
    else
      [ 'icons/user-gray_gray.png', 'No confirmed contact' ]
    end

    if only_image
      image_tag icon, :title => title, :alt => title
    else
      content_tag :div, title, :class => 'friend_status', :style => "background-image: url(#{image_path icon})"
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
serum-rails-0.2.1 spec/test_apps/rails-2-3/app/helpers/user_helper.rb
serum-rails-0.2.0 spec/test_apps/rails-2-3/app/helpers/user_helper.rb
serum-rails-0.1.1 spec/test_app/app/helpers/user_helper.rb
serum-rails-0.1.0 spec/test_app/app/helpers/user_helper.rb