Class: Arclight::DocumentComponent

Inherits:
Blacklight::DocumentComponent
  • Object
show all
Defined in:
app/components/arclight/document_component.rb

Overview

Render a single document

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



6
7
8
# File 'app/components/arclight/document_component.rb', line 6

def document
  @document
end

Instance Method Details

#accessObject



37
38
39
# File 'app/components/arclight/document_component.rb', line 37

def access
  render (blacklight_config.show.access_component || Arclight::AccessComponent).new(presenter: presenter)
end

#blacklight_configObject



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

def blacklight_config
  presenter.configuration
end

#bookmark_configBlacklight::Configuration::ToolConfig

Returns the configuration for the bookmark.

Returns:

  • (Blacklight::Configuration::ToolConfig)

    the configuration for the bookmark



17
18
19
# File 'app/components/arclight/document_component.rb', line 17

def bookmark_config
  blacklight_config.index.document_actions.arclight_bookmark_control
end


21
22
23
# File 'app/components/arclight/document_component.rb', line 21

def breadcrumb_component
  blacklight_config.show.breadcrumb_component || Arclight::BreadcrumbsHierarchyComponent
end

#component_metadata_partialsObject



29
30
31
# File 'app/components/arclight/document_component.rb', line 29

def 
  blacklight_config.show. || []
end

#metadata_partialsObject



25
26
27
# File 'app/components/arclight/document_component.rb', line 25

def 
  blacklight_config.show. || []
end

#online_content?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'app/components/arclight/document_component.rb', line 8

def online_content?
  document.online_content? && (document.collection? || document.children?)
end

#online_filterObject



33
34
35
# File 'app/components/arclight/document_component.rb', line 33

def online_filter
  render Arclight::OnlineContentFilterComponent.new(document: document)
end

#toggle_sidebarObject



41
42
43
44
45
46
47
# File 'app/components/arclight/document_component.rb', line 41

def toggle_sidebar
  button_tag(t('arclight.views.show.toggle_sidebar'),
             type: :button,
             class: 'btn btn-sm btn-secondary d-lg-none sidebar-toggle',
             data: { bs_toggle: 'offcanvas', bs_target: '#sidebar' },
             aria: { controls: 'sidebar' })
end