Sha256: e48da122d7ed3e53423dfed159ef95ebfaec7d96889bdfe80ff1070f23e4865c

Contents?: true

Size: 636 Bytes

Versions: 42

Compression:

Stored size: 636 Bytes

Contents

# frozen_string_literal: true

require 'thredded/email_transformer/base'
module Thredded
  module EmailTransformer
    # Wraps oneboxes with tables, because only tables can have borders in most email clients.
    class Onebox < Base
      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
    end
  end
end

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
thredded-1.1.0 lib/thredded/email_transformer/onebox.rb
thredded-1.0.1 lib/thredded/email_transformer/onebox.rb
thredded-1.0.0 lib/thredded/email_transformer/onebox.rb
thredded-0.16.16 lib/thredded/email_transformer/onebox.rb
thredded-0.16.15 lib/thredded/email_transformer/onebox.rb
thredded-0.16.14 lib/thredded/email_transformer/onebox.rb
thredded-0.16.13 lib/thredded/email_transformer/onebox.rb
thredded-0.16.12 lib/thredded/email_transformer/onebox.rb
thredded-0.16.11 lib/thredded/email_transformer/onebox.rb
thredded-0.16.10 lib/thredded/email_transformer/onebox.rb
thredded-0.16.9 lib/thredded/email_transformer/onebox.rb
thredded-0.16.8 lib/thredded/email_transformer/onebox.rb
thredded-0.16.7 lib/thredded/email_transformer/onebox.rb
thredded-0.16.6 lib/thredded/email_transformer/onebox.rb
thredded-0.16.5 lib/thredded/email_transformer/onebox.rb
thredded-0.16.4 lib/thredded/email_transformer/onebox.rb
thredded-0.16.3 lib/thredded/email_transformer/onebox.rb
thredded-0.16.1 lib/thredded/email_transformer/onebox.rb
thredded-0.16.0 lib/thredded/email_transformer/onebox.rb
thredded-0.15.5 lib/thredded/email_transformer/onebox.rb