Class: Arclight::IndexMetadataFieldComponent

Inherits:
Blacklight::MetadataFieldComponent
  • Object
show all
Defined in:
app/components/arclight/index_metadata_field_component.rb

Overview

Render a simple metadata field (e.g. without labels) in a .row div

Instance Method Summary collapse

Constructor Details

#initialize(field:, classes: ['col'], **kwargs) ⇒ IndexMetadataFieldComponent

Returns a new instance of IndexMetadataFieldComponent.



6
7
8
9
10
# File 'app/components/arclight/index_metadata_field_component.rb', line 6

def initialize(field:, classes: ['col'], **kwargs)
  super(field: field, **kwargs)

  @classes = classes + ["al-document-#{@field.key.dasherize}"]
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/components/arclight/index_metadata_field_component.rb', line 12

def render?
  helpers.document_index_view_type != :compact || @field.field_config.compact
end

#truncate?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/components/arclight/index_metadata_field_component.rb', line 16

def truncate?
  !!@field.field_config.truncate
end