Class: Tenon::CommentDecorator

Inherits:
ApplicationDecorator show all
Defined in:
app/decorators/tenon/comment_decorator.rb

Instance Method Summary collapse

Methods inherited from ApplicationDecorator

#delete_link, #edit_link, #edit_path, #path, #published?

Instance Method Details

#author_urlObject



7
8
9
10
11
12
13
14
# File 'app/decorators/tenon/comment_decorator.rb', line 7

def author_url
  url = @object.author_url
  if url.blank? || url.match('http://') || url.match('https://')
    url
  else
    'http://' + url
  end
end

#emailObject



3
4
5
# File 'app/decorators/tenon/comment_decorator.rb', line 3

def email
  @object.author_email
end

#error_messageObject



16
17
18
19
20
# File 'app/decorators/tenon/comment_decorator.rb', line 16

def error_message
  errors = []
  @object.errors.full_messages.each { |error| errors << "<li>#{error}</li>" }
  "<div class='error-explanation' id='error-explanation'>There were problems with the following fields:<ul>#{errors.join('')}<ul></div>"
end