Class: Geoblacklight::Document::DownloadLinkComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Geoblacklight::Document::DownloadLinkComponent
- Defined in:
- app/components/geoblacklight/document/download_link_component.rb
Overview
A single resource available for download on a record
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#file_type ⇒ Object
Infer the file type from the URL if not provided.
-
#initialize(url:, title: nil, file_type: nil, data_file_type: nil) ⇒ DownloadLinkComponent
constructor
A new instance of DownloadLinkComponent.
-
#title ⇒ Object
Use format to label the download if no title is provided.
Constructor Details
#initialize(url:, title: nil, file_type: nil, data_file_type: nil) ⇒ DownloadLinkComponent
Returns a new instance of DownloadLinkComponent.
13 14 15 16 17 18 19 |
# File 'app/components/geoblacklight/document/download_link_component.rb', line 13 def initialize(url:, title: nil, file_type: nil, data_file_type: nil) @url = url @title = title @file_type = file_type @data_file_type = data_file_type super() end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'app/components/geoblacklight/document/download_link_component.rb', line 7 def url @url end |
Instance Method Details
#file_type ⇒ Object
Infer the file type from the URL if not provided
27 28 29 |
# File 'app/components/geoblacklight/document/download_link_component.rb', line 27 def file_type @file_type || wfs_file_type || requested_file_type || file_extension end |
#title ⇒ Object
Use format to label the download if no title is provided
22 23 24 |
# File 'app/components/geoblacklight/document/download_link_component.rb', line 22 def title @title || generated_title_from_format || title_from_format end |