Class: ActiveMail::Components::Button

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

Constant Summary

Constants inherited from Base

ActiveMail::Components::Base::IGNORED_ON_PASSTHROUGH, ActiveMail::Components::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
23
24
# File 'lib/activemail/components/button.rb', line 12

def transform(node, inner)
  expand = class?(node, 'expand')
  inner = anchor(node, inner, expand) if node.attr('href')
  inner = "<center>#{inner}</center>" if expand

  classes = combine_classes(node, 'button')
  expander = expand ? '<td class="expander"></td>' : ''
  [
    %(<table class="#{classes}" #{TABLE_RESET}><tbody><tr><td>),
    %(<table #{TABLE_RESET}><tbody><tr><td>#{inner}</td></tr></tbody></table>),
    %(</td>#{expander}</tr></tbody></table>)
  ].join
end