Module: Diaspora::Mentionable::MentionsInternal

Extended by:
PeopleHelper
Defined in:
lib/diaspora/mentionable.rb

Overview

inline module for namespacing

Class Method Summary collapse

Methods included from PeopleHelper

birthday_format, local_or_remote_person_path, person_image_link, person_image_tag, person_link, search_header

Class Method Details

output a formatted mention link as defined by the given arguments. if the display name is blank, falls back to the person's name.

Parameters:

  • AR (Person)

    Person

  • display (String)

    name

  • formatting (Hash)

    options

See Also:

  • Diaspora::Mentions#format

91
92
93
94
95
96
97
98
99
# File 'lib/diaspora/mentionable.rb', line 91

def self.mention_link(person, display_name, diaspora_id, opts)
  return display_name || diaspora_id unless person.present?

  if opts[:plain_text]
    display_name || person.name
  else
    person_link(person, class: PERSON_HREF_CLASS, display_name: display_name)
  end
end

output a markdown formatted link to the given person with the display name as the link text. if the display name is blank, falls back to the person's name.

Parameters:

Returns:

  • (String)

    markdown person link


107
108
109
110
111
# File 'lib/diaspora/mentionable.rb', line 107

def self.profile_link(person, display_name, diaspora_id)
  return display_name || diaspora_id unless person.present?

  "[#{display_name || person.name}](#{local_or_remote_person_path(person)})"
end