Class: Dbla::DocumentPresenter
- Inherits:
-
Blacklight::DocumentPresenter
- Object
- Blacklight::DocumentPresenter
- Dbla::DocumentPresenter
- Extended by:
- Deprecation
- Includes:
- ActionView::Helpers::OutputSafetyHelper, ActionView::Helpers::TagHelper
- Defined in:
- lib/dbla/document_presenter.rb
Constant Summary collapse
- DESCRIPTIVE_METADATA_KEY =
'sourceResource'.freeze
Instance Method Summary collapse
-
#document_heading ⇒ String
Get the value of the document’s “title” field, or a placeholder value (if empty).
-
#document_show_html_title ⇒ String
Get the document’s “title” to display in the <title> element.
-
#field_value_separator ⇒ String
Default separator to use in #render_field_value.
-
#get_field_values(field, field_config, options = {}) ⇒ Object
Get the value for a document’s field, and prepare to render it.
-
#initialize(document, controller, configuration = controller.blacklight_config) ⇒ DocumentPresenter
constructor
A new instance of DocumentPresenter.
-
#render_document_index_label(field, opts = {}) ⇒ Object
Render the document index heading.
-
#render_document_show_field_value(field, options = {}) ⇒ Object
Render the show field value for a document.
-
#render_field_value(value = nil, field_config = nil) ⇒ String
Render a value (or array of values) from a field.
-
#render_index_field_value(field, options = {}) ⇒ Object
Render the index field label for a document.
- #source_resource_title ⇒ Object
Constructor Details
#initialize(document, controller, configuration = controller.blacklight_config) ⇒ DocumentPresenter
Returns a new instance of DocumentPresenter.
12 13 14 15 16 |
# File 'lib/dbla/document_presenter.rb', line 12 def initialize(document, controller, configuration = controller.blacklight_config) @document = document @configuration = configuration @controller = controller end |
Instance Method Details
#document_heading ⇒ String
Get the value of the document’s “title” field, or a placeholder value (if empty)
26 27 28 |
# File 'lib/dbla/document_presenter.rb', line 26 def document_heading source_resource_title end |
#document_show_html_title ⇒ String
Get the document’s “title” to display in the <title> element. (by default, use the #document_heading)
35 36 37 |
# File 'lib/dbla/document_presenter.rb', line 35 def document_show_html_title source_resource_title end |
#field_value_separator ⇒ String
Default separator to use in #render_field_value
104 105 106 |
# File 'lib/dbla/document_presenter.rb', line 104 def field_value_separator ', ' end |
#get_field_values(field, field_config, options = {}) ⇒ Object
Get the value for a document’s field, and prepare to render it.
-
highlight_field
-
accessor
-
solr field
Rendering:
- helper_method
- link_to_search
TODO : maybe this should be merged with render_field_value, and the ugly signature simplified by pushing some of this logic into the “model”
96 97 98 |
# File 'lib/dbla/document_presenter.rb', line 96 def get_field_values field, field_config, = {} super end |
#render_document_index_label(field, opts = {}) ⇒ Object
Render the document index heading
55 56 57 |
# File 'lib/dbla/document_presenter.rb', line 55 def render_document_index_label field, opts ={} super end |
#render_document_show_field_value(field, options = {}) ⇒ Object
Render the show field value for a document
Allow an extention point where information in the document
may drive the value of the field
@param [String] field
@param [Hash] options
@options opts [String] :value
77 78 79 |
# File 'lib/dbla/document_presenter.rb', line 77 def render_document_show_field_value field, ={} super end |
#render_field_value(value = nil, field_config = nil) ⇒ String
Render a value (or array of values) from a field
44 45 46 |
# File 'lib/dbla/document_presenter.rb', line 44 def render_field_value value=nil, field_config=nil super end |
#render_index_field_value(field, options = {}) ⇒ Object
Render the index field label for a document
Allow an extention point where information in the document
may drive the value of the field
@param [String] field
@param [Hash] opts
@options opts [String] :value
66 67 68 |
# File 'lib/dbla/document_presenter.rb', line 66 def render_index_field_value field, = {} super end |
#source_resource_title ⇒ Object
17 18 19 |
# File 'lib/dbla/document_presenter.rb', line 17 def source_resource_title @document[DESCRIPTIVE_METADATA_KEY] ? (@document[DESCRIPTIVE_METADATA_KEY]['title'] || @document['id']) : @document['id'] end |