Module: AuthorsHelper

Includes:
BlogHelper
Defined in:
app/helpers/authors_helper.rb

Instance Method Summary collapse

Methods included from BlogHelper

#blog_base_url, #this_blog

Instance Method Details

#author_description(user) ⇒ Object



21
22
23
24
25
# File 'app/helpers/authors_helper.rb', line 21

def author_description(user)
  return if user.description.blank?

  tag.div(user.description, id: "author-description")
end


27
28
29
# File 'app/helpers/authors_helper.rb', line 27

def author_link(article)
  ERB::Util.html_escape(article.author_name)
end

#display_profile_item(item, item_desc) ⇒ Object



6
7
8
9
10
11
12
13
# File 'app/helpers/authors_helper.rb', line 6

def display_profile_item(item, item_desc)
  return if item.blank?

  item = link_to(item, item) if is_url?(item)
  tag.li do
    safe_join([item_desc, item], " ")
  end
end

#is_url?(str) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'app/helpers/authors_helper.rb', line 15

def is_url?(str)
  [URI::HTTP, URI::HTTPS].include?(URI.parse(str.to_s).class)
rescue URI::InvalidURIError
  false
end