Class: Blacklight::FieldPresenter
- Inherits:
-
Object
- Object
- Blacklight::FieldPresenter
- Defined in:
- app/presenters/blacklight/field_presenter.rb
Overview
Renders a field and handles link_to_search or helper_method if supplied
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#field_config ⇒ Object
readonly
Returns the value of attribute field_config.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(controller, document, field_config, options) ⇒ FieldPresenter
constructor
A new instance of FieldPresenter.
- #render ⇒ Object
Constructor Details
#initialize(controller, document, field_config, options) ⇒ FieldPresenter
Returns a new instance of FieldPresenter.
4 5 6 7 8 9 |
# File 'app/presenters/blacklight/field_presenter.rb', line 4 def initialize(controller, document, field_config, ) @controller = controller @document = document @field_config = field_config @options = end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
11 12 13 |
# File 'app/presenters/blacklight/field_presenter.rb', line 11 def controller @controller end |
#document ⇒ Object (readonly)
Returns the value of attribute document.
11 12 13 |
# File 'app/presenters/blacklight/field_presenter.rb', line 11 def document @document end |
#field_config ⇒ Object (readonly)
Returns the value of attribute field_config.
11 12 13 |
# File 'app/presenters/blacklight/field_presenter.rb', line 11 def field_config @field_config end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'app/presenters/blacklight/field_presenter.rb', line 11 def @options end |
Instance Method Details
#render ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/presenters/blacklight/field_presenter.rb', line 13 def render if [:value] # This prevents helper methods from drawing. config = Configuration::NullField.new(field_config.to_h.except(:helper_method)) values = Array.wrap([:value]) else config = field_config values = retrieve_values end Rendering::Pipeline.render(values, config, document, controller, ) end |