recent_documents_block.rb 421 Bytes
class RecentDocumentsBlock < Block

  def self.description
    _('List of recent content')
  end

  settings_items :limit

  def content
    docs =
      if self.limit.nil?
        owner.recent_documents
      else
        owner.recent_documents(self.limit)
      end

    block_title(_('Recent content')) +
    content_tag('ul', docs.map {|item| content_tag('li', link_to(item.title, item.url))}.join("\n"))

  end

end