Sha256: c39f1e0da45ecf32b0e2b154504746a5b13825045b154cb7e127a5535aad171b

Contents?: true

Size: 454 Bytes

Versions: 4

Compression:

Stored size: 454 Bytes

Contents

# frozen_string_literal: true

module Katalyst
  module Tables
    module Cells
      # Formats the value as a number
      #
      # Adds a class to the cell to allow for custom styling
      class NumberComponent < CellComponent
        def rendered_value
          value.present? ? number_to_human(value) : ""
        end

        private

        def default_html_attributes
          { class: "type-number" }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
katalyst-tables-3.3.1 app/components/katalyst/tables/cells/number_component.rb
katalyst-tables-3.3.0 app/components/katalyst/tables/cells/number_component.rb
katalyst-tables-3.2.0 app/components/katalyst/tables/cells/number_component.rb
katalyst-tables-3.1.0 app/components/katalyst/tables/cells/number_component.rb