Module: ProfilesHelper

Defined in:
app/helpers/profiles_helper.rb

Instance Method Summary collapse

Instance Method Details

#is_contact_empty?Boolean

Returns true if the “Personal Information” section is empty

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
# File 'app/helpers/profiles_helper.rb', line 22

def is_contact_empty?
  if (@profile.phone?) or (@profile.mobile?) or (@profile.fax?) or (@profile.address?)or 
     (@profile.website?) or (@profile.subject.email?)
    return false
  else
    return true
  end
end

#is_owner?Boolean

Tells if the current subject accessing the profile is its owner or not

Returns:

  • (Boolean)


4
5
6
7
8
9
10
# File 'app/helpers/profiles_helper.rb', line 4

def is_owner?
  if (current_subject.present?) and (@profile.present?) and (@profile.actor == current_subject.actor)
    return true
  else
    return false
  end
end

#is_personal_empty?Boolean

Returns true if the “Personal Information” section is empty

Returns:

  • (Boolean)


13
14
15
16
17
18
19
# File 'app/helpers/profiles_helper.rb', line 13

def is_personal_empty?
  if (@profile.organization?) or (@profile.birthday?) or (@profile.city?) or (@profile.description?)
    return false
  else
    return true
  end
end

#show_if_signed_in(info) ⇒ Object

Returns the value if user is signed in or a link to sign in view



32
33
34
35
# File 'app/helpers/profiles_helper.rb', line 32

def show_if_signed_in(info)
  return info if user_signed_in?
  return link_to t('profile.must_be_signed_id'), new_user_session_path
end