<commit_before>module Georgia
  class PageDecorator < Georgia::ApplicationDecorator

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

    def status_tag(options={})
      options[:class] ||= ''
      options[:class] << ' label'
      if model.is_a? Georgia::MetaPage
        options[:class] << " label-#{human_state_name}"
        h.content_tag(:span, human_state_name, options)
      else
        options[:class] << " label-#{non_namespaced_class_name}"
        h.content_tag(:span, non_namespaced_class_name, options)
      end
    end

    def template_path
      "pages/templates/#{model.template}"
    end

    private

    def non_namespaced_class_name
      @non_namespaced_class_name ||= model.class.to_s.underscore.gsub(/.*\/(.*)/, '\1')
    end

  end
end<commit_msg>Delegate to current_revision<commit_after>module Georgia
  class PageDecorator < Georgia::ApplicationDecorator
    decorates_association :current_revision

    delegate :status_tag, :excerpt_or_text, to: :current_revision

    def template_path
      "pages/templates/#{current_revision.template}"
    end

  end
end
{'fraction_non_alphanumeric': 0.11094108645753634, 'fraction_numerical': 0.00306044376434583, 'mean_word_length': 3.2885245901639344, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2875742', 'n_tokens_mistral': 434, 'n_tokens_neox': 410, 'n_words': 76}