class Inkcite::Renderer::MobileOnly
Public Instance Methods
render(tag, opt, ctx)
click to toggle source
# File lib/inkcite/renderer/mobile_only.rb, line 7 def render tag, opt, ctx # True if this is the open tag ({mobile-only}) is_open = tag == 'mobile-only' html = '' if is_open # Intentionally NOT using 'mso-hide: all' version as it requires all # nested tables to have that attribute applied. Why have all that extra # markup - just use this simple conditional instead. html << '{if-not test="mso 9"}' # These elements style the div such that it is invisible in all # other major email clients. div = Element.new('div') div.style[:display] = 'none' div.style[:'max-height'] = 0 div.style[:'overflow'] = 'hidden' klass = opt[:inline] ? 'show-inline' : 'show' mix_responsive_klass div, opt, ctx, klass html << div.to_s else # Close the div html << '</div>' # Close the outlook conditional for the close tag. html << '{/if-not}' end html end