Class: Georgia::RevisionDecorator

Inherits:
ApplicationDecorator show all
Defined in:
app/decorators/georgia/revision_decorator.rb

Instance Method Summary collapse

Methods inherited from ApplicationDecorator

#pretty_created_at, #pretty_updated_at

Instance Method Details

#excerpt_or_textObject



4
5
6
7
8
9
10
# File 'app/decorators/georgia/revision_decorator.rb', line 4

def excerpt_or_text
  if content.excerpt.present?
    h.raw(content.excerpt)
  elsif content.text.present?
    h.truncate(h.strip_tags(content.text), length: 255, separator: ' ').html_safe
  end
end

#meta_descriptionObject



12
13
14
15
16
17
18
# File 'app/decorators/georgia/revision_decorator.rb', line 12

def meta_description
  if content.excerpt.present?
    content.excerpt.squish
  elsif content.text.present?
    h.truncate(h.strip_tags(content.text).squish, length: 240, separator: ' ').html_safe
  end
end

#status_tag(options = {}) ⇒ Object



20
21
22
23
24
25
# File 'app/decorators/georgia/revision_decorator.rb', line 20

def status_tag(options={})
  options[:class] ||= ''
  options[:class] << ' label'
  options[:class] << " label-#{human_state_name}"
  h.(:span, human_state_name, options)
end