diff --git a/.env b/.env index 17ad1092..4c668955 100644 --- a/.env +++ b/.env @@ -8,6 +8,7 @@ DB_TEST_NAME=hyku_test DB_USER=postgres DB_HOST=db DB_PORT=5432 +ENGINE_MOUNT=authorities FCREPO_HOST=fcrepo FCREPO_PORT=8080 FCREPO_URL=http://fcrepo:8080/rest diff --git a/app/views/records/edit_fields/_subject.html.erb b/app/views/records/edit_fields/_subject.html.erb new file mode 100644 index 00000000..d389f4d0 --- /dev/null +++ b/app/views/records/edit_fields/_subject.html.erb @@ -0,0 +1,13 @@ +<%= f.input :subject, + # TODO(shanalmoore) as: :controlled_vocabulary is not working for some reason, + as: :multi_value, + placeholder: 'Search for a subject', + input_html: { + class: 'form-control', + data: { 'autocomplete-url' => "/authorities/search/loc/subjects", + 'autocomplete' => key } + }, + ### Required for the ControlledVocabulary javascript: + wrapper_html: { data: { 'autocomplete-url' => "/authorities/search/loc/subjects", + 'field-name' => key }}, + required: f.object.required?(key) %> diff --git a/config/initializers/qa.rb b/config/initializers/qa.rb new file mode 100644 index 00000000..2509c1bd --- /dev/null +++ b/config/initializers/qa.rb @@ -0,0 +1,31 @@ +Qa.config do |config| + # When enabled, CORS headers will be added to the responses for search and show. `OPTIONS` method will also be supported. + # Uncomment one of the lines below to enable or disable CORS headers. This configuration defaults to disabled when not set. + # More information on CORS headers at: https://fetch.spec.whatwg.org/#cors-protocol + # config.enable_cors_headers + # config.disable_cors_headers + + # Provide a token that allows reloading of linked data authorities through the controller + # action '/reload/linked_data/authorities?auth_token=YOUR_AUTH_TOKEN_DEFINED_HERE' without + # requiring a restart of rails. By default, reloading through the browser is not allowed + # when the token is nil or blank. Change to any string to control who has access to reload. + config.authorized_reload_token = 'YOUR_AUTH_TOKEN_DEFINED_HERE' + + # For linked data access, specify default language for sorting and selection. The default is only used if a language is not + # specified in the authority's configuration file and not passed in as a parameter. (e.g. :en, [:en], or [:en, :fr]) + # config.default_language = :en + + # When true, prevents ldpath requests from making additional network calls. All values will come from the context graph + # passed to the ldpath request. + # config.limit_ldpath_to_context = true + + # Define default behavior for property_map.optional? when it is not defined in the configuration for a property. + # When false, properties that do not override default optional behavior will be shown whether or not the property has a value in the graph. + # When true, properties that do not override default optional behavior will not be shown whn the property does not have a value in the graph. + # config.property_map_default_for_optional = false + + # IP data including IP address, city, state, and country will be logged with each request. + # When false, IP data is logged + # When true, IP data will not be logged (default for backward compatibility) + # config.suppress_ip_data_from_log = true +end diff --git a/config/oclcts-authorities.yml b/config/oclcts-authorities.yml new file mode 100644 index 00000000..925fcf07 --- /dev/null +++ b/config/oclcts-authorities.yml @@ -0,0 +1,24 @@ +url-pattern: + prefix-query: http://tspilot.oclc.org/{authority-id}/?query=oclcts.rootHeading+exact+%22{query}*%22&version=1.1&operation=searchRetrieve&recordSchema=http%3A%2F%2Fzthes.z3950.org%2Fxml%2F1.0%2F&maximumRecords=10&startRecord=1&resultSetTTL=300&recordPacking=xml&recordXPath=&sortKeys= + id-lookup: http://tspilot.oclc.org/{authority-id}/?query=dc.identifier+exact+%22{id}%22&version=1.1&operation=searchRetrieve&recordSchema=http%3A%2F%2Fzthes.z3950.org%2Fxml%2F1.0%2F&maximumRecords=10&startRecord=1&resultSetTTL=300&recordPacking=xml&recordXPath=&sortKeys= +authorities: + lcgft: + name: Library of Congress Genre/Form Terms for Library and Archival Materials (LCGFT) + bisacsh: + name: Book Industry Study Group Subject Headings (BISAC®). Used with permission. + fast: + name: Faceted Application of Subject Terminology (FAST subject headings) + gsafd: + name: Form and genre headings for fiction and drama + lcshac: + name: Library of Congress AC Subject Headings + lcsh: + name: Library of Congress Subject Headings + mesh: + name: Medical Subject Headings (MeSH®) + lctgm: + name: "Thesaurus for graphic materials: TGM I, Subject terms" + gmgpc: + name: "Thesaurus for graphic materials: TGM II, Genre terms" + meta: + name: Controlled Vocabulary Metadata diff --git a/spec/views/records/edit_fields/_subject.html.erb_spec.rb b/spec/views/records/edit_fields/_subject.html.erb_spec.rb new file mode 100644 index 00000000..c65e9839 --- /dev/null +++ b/spec/views/records/edit_fields/_subject.html.erb_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +RSpec.describe 'records/edit_fields/_subject.html.erb', type: :view do + let(:work) { GenericWork.new } + let(:form) { Hyrax::GenericWorkForm.new(work, nil, controller) } + let(:form_template) do + %( + <%= simple_form_for [main_app, @form] do |f| %> + <%= render "records/edit_fields/subject", f: f, key: 'subject' %> + <% end %> + ) + end + + before do + assign(:form, form) + render inline: form_template + end + + it 'has url for autocomplete service' do + expect(rendered).to have_selector( + 'input[data-autocomplete-url="/authorities/search/loc/subjects"][data-autocomplete="subject"]' + ) + end +end