Sha256: f1df2aef4ce13a1c62912d805e1d2cfa0031284bc239abd19bdfed2e3c2f13a7

Contents?: true

Size: 617 Bytes

Versions: 2

Compression:

Stored size: 617 Bytes

Contents

# frozen_string_literal: true

module Wallaby
  module Resources
    module Index
      # Html cell
      class JsonHtml < Cell
        # @return [String]
        def render
          if value.nil?
            null
          else
            max = metadata[:max] || default_metadata.max
            self.value = value.to_s
            if value.length > max
              concat content_tag(:code, value.truncate(max))
              imodal metadata[:label], "<pre>#{h value}</pre>".html_safe
            else
              content_tag :code, value
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wallaby-6.0.2 app/views/wallaby/resources/index/json_html.rb
wallaby-6.0.1 app/views/wallaby/resources/index/json_html.rb