Sha256: 2e845b0c36f88624695cbb157ebf2b58c1b77f55f0702c054d08d44da679dae1

Contents?: true

Size: 561 Bytes

Versions: 11

Compression:

Stored size: 561 Bytes

Contents

module BootstrapEmail
  module Converter
    class PreviewText < Base
      def build
        preview_node = doc.at_css('preview')
        return if preview_node.nil?

        # apply spacing after the text max of 100 characters so it doesn't show body text
        preview_node.inner_html += '&nbsp;' * [(100 - preview_node.content.length.to_i), 0].max
        node = template('div', classes: 'preview', contents: preview_node.content)
        preview_node.remove

        body = doc.at_css('body')
        body.prepend_child(node)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
bootstrap-email-1.1.4 lib/bootstrap-email/converters/preview_text.rb
bootstrap-email-1.1.3 lib/bootstrap-email/converters/preview_text.rb
bootstrap-email-1.1.2 lib/bootstrap-email/converters/preview_text.rb
bootstrap-email-1.1.1 lib/bootstrap-email/converters/preview_text.rb
bootstrap-email-1.1.0 lib/bootstrap-email/converters/preview_text.rb
bootstrap-email-1.0.2 lib/bootstrap-email/converters/preview_text.rb
bootstrap-email-1.0.1 lib/bootstrap-email/converters/preview_text.rb
bootstrap-email-1.0.0 lib/bootstrap-email/converters/preview_text.rb
bootstrap-email-1.0.0.alpha4 lib/bootstrap-email/converters/preview_text.rb
bootstrap-email-1.0.0.alpha3.1 lib/bootstrap-email/converters/preview_text.rb
bootstrap-email-1.0.0.alpha3 lib/bootstrap-email/converters/preview_text.rb