Class: Thredded::EmailTransformer::Onebox

Inherits:
Base
  • Object
show all
Defined in:
lib/thredded/email_transformer/onebox.rb

Overview

Wraps oneboxes with tables, because only tables can have borders in most email clients.

Instance Attribute Summary

Attributes inherited from Base

#doc

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize

Methods included from Helpers

#anchor, #paragraph

Constructor Details

This class inherits a constructor from Thredded::EmailTransformer::Base

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/thredded/email_transformer/onebox.rb', line 8

def call
  doc.css('aside.onebox').each do |onebox|
    table = Nokogiri::XML::Node.new('table', doc)
    table['class'] = 'onebox-wrapper-table'
    onebox.swap table
    table
      .add_child(Nokogiri::XML::Node.new('tr', doc))
      .add_child(Nokogiri::XML::Node.new('td', doc))
      .add_child(onebox)
  end
end