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-0.15.4 lib/thredded/email_transformer/onebox.rb
thredded-0.15.3 lib/thredded/email_transformer/onebox.rb
thredded-0.15.2 lib/thredded/email_transformer/onebox.rb
thredded-0.15.1 lib/thredded/email_transformer/onebox.rb
threddedDANIEL-0.14.5 lib/thredded/email_transformer/onebox.rb
thredded-0.14.4 lib/thredded/email_transformer/onebox.rb
thredded-0.14.3 lib/thredded/email_transformer/onebox.rb
thredded-0.14.2 lib/thredded/email_transformer/onebox.rb
thredded-0.14.1 lib/thredded/email_transformer/onebox.rb
thredded-0.14.0 lib/thredded/email_transformer/onebox.rb
thredded-0.13.8 lib/thredded/email_transformer/onebox.rb
thredded-0.13.7 lib/thredded/email_transformer/onebox.rb
thredded-0.13.6 lib/thredded/email_transformer/onebox.rb
thredded-0.13.5 lib/thredded/email_transformer/onebox.rb
thredded-0.13.4 lib/thredded/email_transformer/onebox.rb
thredded-0.13.3 lib/thredded/email_transformer/onebox.rb
thredded-0.13.2 lib/thredded/email_transformer/onebox.rb
thredded-0.13.1 lib/thredded/email_transformer/onebox.rb
thredded-0.13.0 lib/thredded/email_transformer/onebox.rb
thredded-0.12.4 lib/thredded/email_transformer/onebox.rb