Sha256: 2c18c829258be3424c140930c6483094399631e221e29b64022339df7d39da30

Contents?: true

Size: 1.17 KB

Versions: 15

Compression:

Stored size: 1.17 KB

Contents

module Europeana
  module Blacklight
    ##
    # Blacklight document presenter for Europeana documents
    class DocumentPresenter < ::Blacklight::DocumentPresenter
      include ActionView::Helpers::AssetTagHelper # ?

      def render_document_show_field_value(field, options = {})
        render_nested_field_value(field, :show, options)
      end

      def render_index_field_value(field, options = {})
        render_nested_field_value(field, :index, options)
      end

      def render_nested_field_value(field, context, options = {})
        key = @document.nested_field_key(field)
        container = @document.nested_field_container(field)

        field_config = @configuration.send(:"#{context}_fields")[key]
        value = options[:value] || begin
          [container].flatten.compact.collect do |target|
            presenter = self.class.new(target, @controller, @configuration)
            presenter.get_field_values(key, field_config, options)
          end.compact.flatten
        end

        render_field_value(value, field_config)
      end

      def get_field_values(field, field_config, options = {})
        @document.localize_lang_map(super)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
europeana-blacklight-1.2.2 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-1.2.1 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-1.2.0 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-1.1.0 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-1.0.0 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-0.5.2 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-0.5.1 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-0.5.0 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-0.4.9 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-0.4.8 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-0.4.7 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-0.4.6 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-0.4.5 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-0.4.4 app/presenters/europeana/blacklight/document_presenter.rb
europeana-blacklight-0.4.3 app/presenters/europeana/blacklight/document_presenter.rb