aboutsummaryrefslogtreecommitdiffstats
path: root/app/decorators/models/sidebar_post_decorator.rb
blob: 14cbe7c7720aafca09072d273be0ab3ffa151d03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'delegate'

class SidebarPostDecorator < SimpleDelegator
  include ActionView::Helpers::TagHelper
  include ActionView::Helpers::TextHelper

  def initialize(post)
    super(post)
  end

  def title
    content_tag(:h2, super)
  end

  def body
    content_tag(:div, sanitize(truncate(super, :length => 32, :separator => ' ')))
  end
end