Sha256: 474ab432efb2bb0a881e9d7b0c5b9bd8deb9ac6a357e72b2dd491270775612df

Contents?: true

Size: 664 Bytes

Versions: 43

Compression:

Stored size: 664 Bytes

Contents

# frozen_string_literal: true

module Koi
  module SummaryList
    class ItemComponent < Base
      def render?
        !(@skip_blank && raw_value.blank? && raw_value != false)
      end

      def attribute_value
        case raw_value
        when Array
          raw_value.join(", ")
        when ActiveStorage::Attached::One
          raw_value.attached? ? link_to(raw_value.filename, url_for(raw_value)) : ""
        when Date, Time, DateTime, ActiveSupport::TimeWithZone
          l(raw_value, format: :admin)
        when TrueClass, FalseClass
          raw_value ? "Yes" : "No"
        else
          raw_value.to_s
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
katalyst-koi-4.15.1 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.15.0 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.14.3 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.14.2 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.14.1 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.14.0 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.13.2 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.13.0 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.12.6 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.12.5 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.12.4 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.12.3 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.12.2 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.12.1 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.12.0 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.11.2 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.11.1 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.11.0 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.10.3 app/components/koi/summary_list/item_component.rb
katalyst-koi-4.10.2 app/components/koi/summary_list/item_component.rb