Class: ActiveMail::Components::Container

Inherits:
Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/activemail/components/container.rb

Constant Summary

Constants inherited from Base

Base::IGNORED_ON_PASSTHROUGH, Base::TABLE_RESET

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ActiveMail::Components::Base

Instance Method Details

#transform(node, inner) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/activemail/components/container.rb', line 12

def transform(node, inner)
  attributes = combine_attributes(node, 'container')
  width = container_width
  # Outlook Word ignores max-width; the MSO ghost table pins the width.
  [
    %(<!--[if mso | IE]><table #{TABLE_RESET} align="center" width="#{width}"><tr><td><![endif]-->),
    %(<table #{attributes} #{TABLE_RESET} align="center"#{style_attribute(node, "width:100%;max-width:#{width}px;margin:0 auto;")}>),
    %(<tbody><tr><td>#{inner}</td></tr></tbody></table>),
    '<!--[if mso | IE]></td></tr></table><![endif]-->'
  ].join
end