Module: Arclight::FieldConfigHelpers
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActionView::Helpers::OutputSafetyHelper, ActionView::Helpers::TagHelper, EadFormatHelpers
- Included in:
- CatalogController
- Defined in:
- app/controllers/concerns/arclight/field_config_helpers.rb
Overview
A module to add configuration helpers for certain fields used by Arclight
Instance Method Summary collapse
- #access_repository_contact(args) ⇒ Object
- #before_you_visit_note_present(_, document) ⇒ Object
- #context_access_tab_repository(args) ⇒ Object
- #context_access_tab_visit_note(args) ⇒ Object
- #context_sidebar_containers_request(args) ⇒ Object
- #highlight_terms(args) ⇒ Object
- #item_requestable?(_, options) ⇒ Boolean
- #link_to_name_facet(args) ⇒ Object
- #paragraph_separator(args) ⇒ Object
- #repository_config_present(_, document) ⇒ Object
- #request_config_present(var, document) ⇒ Object
Methods included from EadFormatHelpers
Instance Method Details
#access_repository_contact(args) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'app/controllers/concerns/arclight/field_config_helpers.rb', line 52 def access_repository_contact(args) document = args[:document] ApplicationController.renderer.render( 'arclight/repositories/_repository_contact', layout: false, locals: { repository: document.repository_config } ) end |
#before_you_visit_note_present(_, document) ⇒ Object
61 62 63 |
# File 'app/controllers/concerns/arclight/field_config_helpers.rb', line 61 def before_you_visit_note_present(_, document) document.repository_config && document.repository_config.visit_note.present? end |
#context_access_tab_repository(args) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'app/controllers/concerns/arclight/field_config_helpers.rb', line 43 def context_access_tab_repository(args) document = args[:document] ApplicationController.renderer.render( 'arclight/repositories/_in_person_repository', layout: false, locals: { repository: document.repository_config } ) end |
#context_access_tab_visit_note(args) ⇒ Object
65 66 67 68 |
# File 'app/controllers/concerns/arclight/field_config_helpers.rb', line 65 def context_access_tab_visit_note(args) document = args[:document] document.repository_config.visit_note end |
#context_sidebar_containers_request(args) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 |
# File 'app/controllers/concerns/arclight/field_config_helpers.rb', line 74 def (args) document = args[:document] presenter = Arclight::ShowPresenter.new(document, view_context) ApplicationController.renderer.render( 'arclight/requests/_google_form', layout: false, locals: { google_form: Arclight::Requests::GoogleForm.new(document, presenter, solr_document_url(document)) } ) end |
#highlight_terms(args) ⇒ Object
70 71 72 |
# File 'app/controllers/concerns/arclight/field_config_helpers.rb', line 70 def highlight_terms(args) safe_join(args[:value].map { |value| content_tag(:span, value, class: 'bg-info') }) end |
#item_requestable?(_, options) ⇒ Boolean
33 34 35 36 |
# File 'app/controllers/concerns/arclight/field_config_helpers.rb', line 33 def item_requestable?(_, ) document = [:document] request_config_present('', document) end |
#link_to_name_facet(args) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 |
# File 'app/controllers/concerns/arclight/field_config_helpers.rb', line 90 def link_to_name_facet(args) = args[:config].try(:separator_options) || {} values = args[:value] || [] values.map do |value| view_context.link_to( value, view_context.search_action_path(f: { names_ssim: [value] }) ) end.to_sentence().html_safe end |
#paragraph_separator(args) ⇒ Object
86 87 88 |
# File 'app/controllers/concerns/arclight/field_config_helpers.rb', line 86 def paragraph_separator(args) safe_join(args[:value].map { |paragraph| content_tag(:p, paragraph) }) end |
#repository_config_present(_, document) ⇒ Object
29 30 31 |
# File 'app/controllers/concerns/arclight/field_config_helpers.rb', line 29 def repository_config_present(_, document) document.repository_config.present? end |
#request_config_present(var, document) ⇒ Object
38 39 40 41 |
# File 'app/controllers/concerns/arclight/field_config_helpers.rb', line 38 def request_config_present(var, document) repository_config_present(var, document) && document.repository_config.request_config_present? end |