Class: Blacklight::DocumentPresenter Deprecated

Inherits:
Object
  • Object
show all
Extended by:
Deprecation
Defined in:
app/presenters/blacklight/document_presenter.rb

Overview

Deprecated.

Instance Method Summary collapse

Constructor Details

#initialize(document, controller, configuration = controller.blacklight_config) ⇒ DocumentPresenter

Returns a new instance of DocumentPresenter.

Parameters:

  • document (SolrDocument)
  • controller (ActionController::Base)

    scope for linking and generating urls

  • configuration (Blacklight::Configuration) (defaults to: controller.blacklight_config)


11
12
13
14
15
# File 'app/presenters/blacklight/document_presenter.rb', line 11

def initialize(document, controller, configuration = controller.blacklight_config)
  @document = document
  @configuration = configuration
  @controller = controller
end

Instance Method Details

#document_headingString

Deprecated.

use ShowPresenter#heading instead

Get the value of the document's “title” field, or a placeholder value (if empty)

Returns:

  • (String)


23
24
25
# File 'app/presenters/blacklight/document_presenter.rb', line 23

def document_heading
  show_presenter.heading
end

#document_show_html_titleString

Deprecated.

use ShowPresenter#html_title instead

Get the document's “title” to display in the <title> element. (by default, use the #document_heading)

Returns:

  • (String)

See Also:



49
50
51
# File 'app/presenters/blacklight/document_presenter.rb', line 49

def document_show_html_title
  show_presenter.html_title
end

#field_values(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

Parameters:

  • field_config (Blacklight::Configuration::Field)

    solr field configuration

  • options (Hash) (defaults to: {})

    additional options to pass to the rendering helpers



126
127
128
# File 'app/presenters/blacklight/document_presenter.rb', line 126

def field_values(field_config, options={})
  FieldPresenter.new(@controller, @document, field_config, options).render
end

#get_field_values(_field, field_config, options = {}) ⇒ Object

Deprecated.

Get the value for a document's field, and prepare to render it.

  • highlight_field

  • accessor

  • solr field

Rendering:

- helper_method
- link_to_search

Parameters:

  • _field (String)

    name

  • field_config (Blacklight::Configuration::Field)

    solr field configuration

  • options (Hash) (defaults to: {})

    additional options to pass to the rendering helpers



110
111
112
# File 'app/presenters/blacklight/document_presenter.rb', line 110

def get_field_values _field, field_config, options = {}
  field_values(field_config, options)
end
Deprecated.

moved to ShowPresenter#link_rel_alternates

Create <link rel=“alternate”> links from a documents dynamically provided export formats. Returns empty string if no links available.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :unique (Boolean)

    ensures only one link is output for every content type, e.g. as required by atom

  • :exclude (Array<String>)

    array of format shortnames to not include in the output



37
38
39
# File 'app/presenters/blacklight/document_presenter.rb', line 37

def link_rel_alternates(options = {})
  show_presenter.link_rel_alternates(options)
end

#render_document_index_label(field, opts) ⇒ Object

Deprecated.

use IndexPresenter#label instead

Render the document index heading

Parameters:

  • field (Symbol, Proc, String)

    Render the given field or evaluate the proc or render the given string

  • opts (Hash)


61
62
63
# File 'app/presenters/blacklight/document_presenter.rb', line 61

def render_document_index_label(*args)
  index_presenter.label(*args)
end

#render_index_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
Deprecated.

use ShowPresenter#field_value

Parameters:

  • field (String)
  • options (Hash)

Options Hash (options):

  • :value (String)


92
93
94
# File 'app/presenters/blacklight/document_presenter.rb', line 92

def render_document_show_field_value *args
  show_presenter.field_value(*args)
end

#render_field_value(values, field_config = Configuration::NullField.new) ⇒ Object

Deprecated.


132
133
134
# File 'app/presenters/blacklight/document_presenter.rb', line 132

def render_field_value(values, field_config = Configuration::NullField.new)
  field_values(field_config, value: Array(values))
end

#render_index_field_value(field, opts) ⇒ Object

Deprecated.

use IndexPresenter#field_value instead

Render the index field label for a document

Allow an extention point where information in the document may drive the value of the field

Parameters:

  • field (String)
  • opts (Hash)

Options Hash (opts):

  • :value (String)


76
77
78
# File 'app/presenters/blacklight/document_presenter.rb', line 76

def render_index_field_value *args
  index_presenter.field_value(*args)
end

#render_values(values, field_config = Configuration::NullField.new) ⇒ Object

Deprecated.


138
139
140
# File 'app/presenters/blacklight/document_presenter.rb', line 138

def render_values(values, field_config = Configuration::NullField.new)
  field_values(field_config, value: Array(values))
end