Sha256: 0764f178262b5d1d9d314ed97419b9569fc697788f51c5052dcd63f26f3940b5

Contents?: true

Size: 758 Bytes

Versions: 10

Compression:

Stored size: 758 Bytes

Contents

module Georgia
  class RevisionDecorator < Georgia::ApplicationDecorator

    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

    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

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

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
georgia-0.8.0 app/decorators/georgia/revision_decorator.rb
georgia-0.7.8 app/decorators/georgia/revision_decorator.rb
georgia-0.7.7 app/decorators/georgia/revision_decorator.rb
georgia-0.7.6 app/decorators/georgia/revision_decorator.rb
georgia-0.7.5 app/decorators/georgia/revision_decorator.rb
georgia-0.7.4 app/decorators/georgia/revision_decorator.rb
georgia-0.7.3 app/decorators/georgia/revision_decorator.rb
georgia-0.7.2 app/decorators/georgia/revision_decorator.rb
georgia-0.7.1 app/decorators/georgia/revision_decorator.rb
georgia-0.7.0 app/decorators/georgia/revision_decorator.rb