Sha256: e14cd061ba3d20c5b22b79431e35c86e3d413c53fa2bb8a2269e5497ec8b9fb6

Contents?: true

Size: 753 Bytes

Versions: 9

Compression:

Stored size: 753 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module EacRailsUtils
  module DataTableHelper
    class DataTable
      class ValueCell
        enable_method_class
        common_constructor :data_table, :column, :record
        delegate :view, to: :data_table

        # @return [ActiveSupport::SafeBuffer]
        def result
          view.content_tag('td', column.record_value(record), tag_attributes)
        end

        # @return [Object]
        def tag_attribute_value(value)
          value.is_a?(::Proc) ? value.call(record) : value
        end

        # @return [Hash]
        def tag_attributes
          column.value_cell_attributes.map { |k, v| [k, tag_attribute_value(v)] }.to_h
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
eac_rails_utils-0.23.1 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.23.0 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.22.3 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.22.2 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.22.1 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.22.0 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.21.0 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.20.0 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb
eac_rails_utils-0.19.0 app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb