diff --git a/app/assets/stylesheets/adl-overrides/adl-overrides.scss b/app/assets/stylesheets/adl-overrides/adl-overrides.scss index 9f026858..b9e6285e 100644 --- a/app/assets/stylesheets/adl-overrides/adl-overrides.scss +++ b/app/assets/stylesheets/adl-overrides/adl-overrides.scss @@ -73,7 +73,7 @@ body.adventist_digital_library { } } - .btn.btn-default { + .btn.btn-secondary { background-color: $white; border-color: $darkyellow; border: 2px solid $darkyellow; @@ -104,7 +104,7 @@ body.adventist_digital_library { } } - .btn.btn-primary, .btn.btn-default { + .btn.btn-primary, .btn.btn-secondary{ &.disabled:hover, &.disabled:hover, &.disabled:focus, @@ -296,7 +296,7 @@ body.adventist_digital_library { } .search-widgets, #sort-dropdown, #per_page-dropdown { - .btn.btn-default { + .btn.btn-secondary { &.view-type-gallery, &.view-type-list, &.view-type-masonry, &.view-type-slideshow, &.dropdown-toggle { border-color: $lightgreyborder; color: $darkgrey; diff --git a/app/assets/stylesheets/adl-overrides/navbar.scss b/app/assets/stylesheets/adl-overrides/navbar.scss index 2b459941..537b9123 100644 --- a/app/assets/stylesheets/adl-overrides/navbar.scss +++ b/app/assets/stylesheets/adl-overrides/navbar.scss @@ -1,15 +1,6 @@ -// Set the nav background color OUTSIDE of the body tag so that it can be overridden by appearance styles -.adventist_digital_library #masthead.navbar { - background: linear-gradient(to bottom, $mediumyellow, rgb(255, 255, 255), $transparentwhite, rgba(255, 255, 255, 0)); - z-index: 1; -} - -.adventist_digital_library #masthead.navbar.bg-dark { - background-color: transparent !important; -} - body.adventist_digital_library { - // MAIN NAV + + // MAIN NAV #masthead { &.navbar { @@ -17,6 +8,12 @@ body.adventist_digital_library { display: flex; width: 100%; margin-bottom: 0; + background: linear-gradient(to bottom, $mediumyellow, rgb(255, 255, 255), $transparentwhite, rgba(255, 255, 255, 0)); + z-index: 1; + + &.bg-dark { + background-color: transparent !important; + } .nav-container { padding-right: 0; diff --git a/app/controllers/hyku_knapsack/pages_controller.rb b/app/controllers/hyku_knapsack/pages_controller.rb deleted file mode 100644 index 62909195..00000000 --- a/app/controllers/hyku_knapsack/pages_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -module HykuKnapsack - class PagesController < ::Hyrax::PagesController - end -end diff --git a/app/forms/hyrax/forms/admin/adl_appearance_decorator.rb b/app/forms/hyrax/forms/admin/adl_appearance_decorator.rb deleted file mode 100644 index c2f18d75..00000000 --- a/app/forms/hyrax/forms/admin/adl_appearance_decorator.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -# OVERRIDE to add adventist's custom colors and fonts -module Hyrax - module Forms - module Admin - module AdlAppearanceDecorator - DEFAULT_COLORS = { - 'custom_adl_header_footer_color' => '#CE8C00', - 'header_and_footer_background_color' => '#000000', - 'header_and_footer_text_color' => '#2C2C2C', - 'navbar_background_color' => '#000000', - 'navbar_link_background_hover_color' => '#000000', - 'navbar_link_text_color' => '#2C2C2C', - 'navbar_link_text_hover_color' => '#FFFFFF', - 'link_color' => '#985F03', - 'link_hover_color' => '#FFBD42', - 'footer_link_color' => '#985F03', - 'footer_link_hover_color' => '#000000', - 'primary_button_hover_color' => '#CE8C00', - 'default_button_background_color' => '#ffffff', - 'default_button_border_color' => '#5B5B5B', - 'default_button_text_color' => '#FFFFFF', - 'active_tabs_background_color' => '#FFFFFF', - 'facet_panel_background_color' => '#000000', - 'facet_panel_text_color' => '#FFFFFF' - }.freeze - - DEFAULT_FONTS = { - 'body_font' => 'Helvetica Neue, Helvetica, Arial, sans-serif;', - 'headline_font' => 'Helvetica Neue, Helvetica, Arial, sans-serif;' - }.freeze - - def custom_adl_header_footer_color - block_for('custom_adl_header_footer_color') - end - end - end - end -end - -Hyrax::Forms::Admin::Appearance.prepend Hyrax::Forms::Admin::AdlAppearanceDecorator - -Hyku::Forms::Admin::Appearance.customization_params << :custom_adl_header_footer_color diff --git a/app/jobs/file_sets_reprocess_job.rb b/app/jobs/file_sets_reprocess_job.rb index 8d59db87..51644345 100644 --- a/app/jobs/file_sets_reprocess_job.rb +++ b/app/jobs/file_sets_reprocess_job.rb @@ -106,7 +106,7 @@ def perform(file_set_id:) # this PDF. return :has_children if parent.child_work_ids.any? - IiifPrint::Jobs::RequestSplitPdfJob.perform_later(file_set:, user: User.batch_user) + IiifPrint::Jobs::RequestSplitPdfJob.perform_later(file_set_id:, user: User.batch_user) :requesting_split end # rubocop:enable Layout/LineLength diff --git a/app/jobs/iiif_print/child_works_from_pdf_job_decorator.rb b/app/jobs/iiif_print/child_works_from_pdf_job_decorator.rb index e71fa115..fdd5ee08 100644 --- a/app/jobs/iiif_print/child_works_from_pdf_job_decorator.rb +++ b/app/jobs/iiif_print/child_works_from_pdf_job_decorator.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# OVERRIDE: Overriding entire job temporarily, pending cleanup via -# https://github.com/notch8/adventist_knapsack/issues/728 # OVERRIDE to end job based on pdfjs/uv flipper before doing anything # so we don't get job errors require 'iiif_print/jobs/application_job' @@ -67,6 +65,7 @@ def perform(id, pdf_paths, user, admin_set_id, *) # rubocop:disable Metrics/MethodLength def split_pdf(original_pdf_path, user, child_model, pdf_file_set) user = User.find_by_user_key(user) unless user.is_a?(User) + # split the pdf into individual pages; pdf_file_set needed for derivative rodeo splitter image_files = @parent_work.iiif_print_config.pdf_splitter_service.call(original_pdf_path, file_set: pdf_file_set) # give as much info as possible if we don't have image files to work with. @@ -92,11 +91,11 @@ def split_pdf(original_pdf_path, user, child_model, pdf_file_set) operation_type: "PDF Batch Create" ) BatchCreateJob.perform_later(user, - @child_work_titles, - @resource_types, - @uploaded_files, - attributes.merge!(model: child_model.to_s, split_from_pdf_id: @split_from_pdf_id).with_indifferent_access, - operation) + @child_work_titles, + @resource_types, + @uploaded_files, + attributes.merge!(model: child_model.to_s, split_from_pdf_id: @split_from_pdf_id).with_indifferent_access, + operation) end # rubocop:enable Metrics/MethodLength # rubocop:enable Metrics/ParameterLists diff --git a/app/models/content_block_decorator.rb b/app/models/content_block_decorator.rb deleted file mode 100644 index 278ff864..00000000 --- a/app/models/content_block_decorator.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -module ContentBlockDecorator - def for(key) - key = key.respond_to?(:to_sym) ? key.to_sym : key - raise ArgumentError, "#{key} is not a ContentBlock name" unless registered?(key) - # Override to refer to .name_registry instead of NAME_REGISTRY - ContentBlock.public_send(name_registry[key]) - end - - # Adding a utility method to check if a key is registered - # TODO: Add something like this to Hyku? It would basically return NAME_REGISTRY - # then in a decorator we can override and call super.merge(foo: :bar) - def name_registry - ContentBlock::NAME_REGISTRY.dup.merge(resources: :resources_page) - end - - # Override to refer to .name_registry instead of NAME_REGISTRY - def registered?(key) - name_registry.include?(key) - end - - # ADL specifc methods - def resources_page - find_or_create_by(name: 'resources_page') - end - - def resources_page=(value) - resources_page.update(value:) - end -end - -ContentBlock.singleton_class.prepend(ContentBlockDecorator) diff --git a/app/views/bulkrax/importers/_oai_adventist_fields.html.erb b/app/views/bulkrax/importers/_oai_adventist_fields.html.erb index 30c73ede..cd413fc2 100644 --- a/app/views/bulkrax/importers/_oai_adventist_fields.html.erb +++ b/app/views/bulkrax/importers/_oai_adventist_fields.html.erb @@ -5,7 +5,7 @@ <%= fi.input :metadata_prefix, as: :string, hint: 'Such as oai_dc, dcterms or oai_qdc', input_html: { value: importer.parser_fields['metadata_prefix'] } %> <%= fi.input :set, collection: [importer.parser_fields['set']], label: 'Set (source)', selected: importer.parser_fields['set'] %> - + <%= fi.input :visibility, collection: [ diff --git a/app/views/hyrax/admin/appearances/_default_colors_form.html.erb b/app/views/hyrax/admin/appearances/_default_colors_form.html.erb deleted file mode 100644 index 4c214eef..00000000 --- a/app/views/hyrax/admin/appearances/_default_colors_form.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%# OVERRIDE Hyku v6.0 to override default colors %> - -<%= simple_form_for @form, url: admin_appearance_path do |f| %> -
- <% @form.class::DEFAULT_COLORS.each do |color_name, hex| %> - <%= render 'color_input', f: f, color_name: color_name, hex: hex %> - <% end %> -
- -<% end %> diff --git a/app/views/hyrax/base/_pdf_js.erb b/app/views/hyrax/base/_pdf_js.erb index c8e9332b..095b41a6 100644 --- a/app/views/hyrax/base/_pdf_js.erb +++ b/app/views/hyrax/base/_pdf_js.erb @@ -1,8 +1,8 @@ -<%# Override Hyku 5 to send presenter to pdf_js_url method %> +<%# Override Hyku 5 to send presenter to pdf_js_url method instead of download_path %>
-
+ \ No newline at end of file diff --git a/app/views/hyrax/base/_show_actions.html.erb b/app/views/hyrax/base/_show_actions.html.erb index 26a2c55b..037efb74 100644 --- a/app/views/hyrax/base/_show_actions.html.erb +++ b/app/views/hyrax/base/_show_actions.html.erb @@ -1,53 +1,54 @@ <%# OVERRIDE Hyku 6.0 to customize layout %> +
- <% if !workflow_restriction?(presenter) %> - <% if presenter.show_deposit_for?(collections: @user_collections) %> - - <%= button_tag t('hyrax.dashboard.my.action.add_to_collection'), - class: 'btn btn-default submits-batches submits-batches-add', - data: { toggle: "modal", target: "#collection-list-container" } %> - <% end %> - <% if presenter.work_featurable? %> - <%= link_to t('.feature'), hyrax.featured_work_path(presenter, format: :json), - data: { behavior: 'feature' }, - class: presenter.display_feature_link? ? 'btn btn-default' : 'btn btn-default collapse' %> + <% if !workflow_restriction?(presenter) %> + <% if presenter.show_deposit_for?(collections: @user_collections) %> + + <%= button_tag t('hyrax.dashboard.my.action.add_to_collection'), + class: 'btn btn-secondary submits-batches submits-batches-add', + data: { toggle: "modal", target: "#collection-list-container" } %> + <% end %> + <% if presenter.work_featurable? %> + <%= link_to t('.feature'), hyrax.featured_work_path(presenter, format: :json), + data: { behavior: 'feature' }, + class: presenter.display_feature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %> - <%= link_to t('.unfeature'), hyrax.featured_work_path(presenter, format: :json), - data: { behavior: 'unfeature' }, - class: presenter.display_unfeature_link? ? 'btn btn-default' : 'btn btn-default collapse' %> + <%= link_to t('.unfeature'), hyrax.featured_work_path(presenter, format: :json), + data: { behavior: 'unfeature' }, + class: presenter.display_unfeature_link? ? 'btn btn-secondary' : 'btn btn-secondary collapse' %> + <% end %> <% end %> - <% end %> - <% if Hyrax.config.analytics? %> - <% # turbolinks needs to be turned off or the page will use the cache and the %> - <% # analytics graph will not show unless the page is refreshed. %> - <%= link_to t('.analytics'), presenter.stats_path, id: 'stats', class: 'btn btn-default', data: { turbolinks: false } %> - <% end %> - - <% if presenter.editor? && !workflow_restriction?(presenter) %> - <%= link_to t('.edit'), edit_polymorphic_path([main_app, presenter]), class: 'btn btn-default', data: { turbolinks: block_valkyrie_redirect? } %> - <% if presenter.member_count > 1 %> - <%= link_to t("hyrax.file_manager.link_text"), polymorphic_path([main_app, :file_manager, presenter]), class: 'btn btn-default' %> + <% if Hyrax.config.analytics_reporting? %> + <% # turbolinks needs to be turned off or the page will use the cache and the %> + <% # analytics graph will not show unless the page is refreshed. %> + <%= link_to t('.analytics'), presenter.stats_path, id: 'stats', class: 'btn btn-secondary', data: { turbolinks: false } %> <% end %> - <% if presenter.valid_child_concerns.length > 0 %> -
- - - <% end %> - <%# OVERRIDE to validate delete permission %> - <% if current_ability.can?(:delete, presenter.solr_document) %> - <%= link_to t('.delete'), [main_app, presenter], class: 'btn btn-danger', data: { confirm: t('.confirm_delete', work_type: presenter.human_readable_type) }, method: :delete %> + <% end %> + <%# OVERRIDE to validate delete permission %> + <% if current_ability.can?(:delete, presenter.solr_document) %> + <%= link_to t('.delete'), [main_app, presenter], class: 'btn btn-danger', data: { confirm: t('.confirm_delete', work_type: presenter.human_readable_type) }, method: :delete %> + <% end %> <% end %> - <% end %>
- + - <%= render 'hyrax/dashboard/collections/form_for_select_collection', user_collections: @user_collections %> +<%= render 'hyrax/dashboard/collections/form_for_select_collection', user_collections: @user_collections %> diff --git a/app/views/hyrax/base/show.html.erb b/app/views/hyrax/base/show.html.erb index 72b479e6..51c7a50b 100644 --- a/app/views/hyrax/base/show.html.erb +++ b/app/views/hyrax/base/show.html.erb @@ -38,8 +38,6 @@
<%= render('download_pdf', presenter: @presenter, file_set_id: @presenter.file_set_presenters.first.id) if @presenter.show_pdf_download_button? %> <%= render 'citations', presenter: @presenter %> - - <%#= render 'analytics_button', presenter: @presenter %>
<% end %>
diff --git a/app/views/hyrax/collections/_sort_and_per_page.html.erb b/app/views/hyrax/collections/_sort_and_per_page.html.erb deleted file mode 100644 index f3f2980a..00000000 --- a/app/views/hyrax/collections/_sort_and_per_page.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<%# OVERRIDE Hyrax 5 to apply styling to pagination above public show collection works list %> - -<% if show_sort_and_per_page? && collection_member_sort_fields.many? %> - <%= form_tag collection_path(collection), method: :get, class: 'per_page form-horizontal' do %> - <%= render 'view_type_group' %> -
- <%= t('hyrax.sort_label') %> - <%= label_tag(:sort, t('.sort_by_html')) %> - - <%= select_tag(:sort, options_from_collection_for_select(collection_member_sort_fields, 'first', lambda {|field| field.last.label}, h(params[:sort])), class: "btn-group btn dropdown-btn dropdown-toggle") %> - <%= label_tag(:per_page) do %> - <%= t('.results_per_page') %> - <%= select_tag(:per_page, options_for_select(Hyrax.config.range_for_number_of_results_to_display_per_page, h(params[:per_page])), title: t('.number_of_results_to_display_per_page'), class: "btn-group btn dropdown-btn dropdown-toggle") %> - <% end %> - <%= render Blacklight::HiddenSearchStateComponent.new(params: search_state.params_for_search.except(:per_page, :sort)) %> -   -
- <% end %> -<% end %> diff --git a/app/views/hyrax/journal_articles/_form_metadata.html.erb b/app/views/hyrax/journal_articles/_form_metadata.html.erb index c7cddad0..a0be5279 100644 --- a/app/views/hyrax/journal_articles/_form_metadata.html.erb +++ b/app/views/hyrax/journal_articles/_form_metadata.html.erb @@ -1,3 +1,4 @@ +<%# OVERRIDE Hyrax 5.0 for custom label %>
<% f.object.primary_terms.each do |term| %> <%= render_edit_field_partial(term, f: f) %> @@ -5,12 +6,12 @@
<% if f.object.display_additional_fields? %> <%= link_to t('hyrax.works.form.additional_fields'), - '#extended-terms', - class: 'btn btn-default additional-fields', - data: { toggle: 'collapse' }, - role: "button", - 'aria-expanded'=> "false", - 'aria-controls'=> "extended-terms" %> + '#extended-terms', + class: 'btn btn-secondary additional-fields', + data: { toggle: 'collapse' }, + role: "button", + 'aria-expanded'=> "false", + 'aria-controls'=> "extended-terms" %>
<%= render 'form_media', f: f %> <% f.object.secondary_terms.each do |term| %> diff --git a/app/views/themes/adventist_digital_library/_user_util_links.html.erb b/app/views/themes/adventist_digital_library/_user_util_links.html.erb index 792a546b..5c0539b8 100644 --- a/app/views/themes/adventist_digital_library/_user_util_links.html.erb +++ b/app/views/themes/adventist_digital_library/_user_util_links.html.erb @@ -9,8 +9,8 @@ <%= link_to t(:'hyrax.controls.about'), hyrax.about_path, class: 'nav-link', aria: current_page?(hyrax.about_path) ? {current: 'page'} : nil %> -
<% end %> diff --git a/app/views/themes/adventist_digital_library/shared/_appearance_styles.html.erb b/app/views/themes/adventist_digital_library/shared/_appearance_styles.html.erb deleted file mode 100644 index 77bc4ee9..00000000 --- a/app/views/themes/adventist_digital_library/shared/_appearance_styles.html.erb +++ /dev/null @@ -1,170 +0,0 @@ -<%# OVERRIDE: Add custom header & footer gradients for Adventist Digital Library %> - -<% # Dynamic styles added by the admin in the appearances page %> -<% appearance = Hyku::Forms::Admin::Appearance.new %> - diff --git a/app/views/themes/adventist_digital_library/shared/_footer.html.erb b/app/views/themes/adventist_digital_library/shared/_footer.html.erb index 011b45de..b74d6728 100644 --- a/app/views/themes/adventist_digital_library/shared/_footer.html.erb +++ b/app/views/themes/adventist_digital_library/shared/_footer.html.erb @@ -7,8 +7,8 @@
"> <%= link_to t(:'hyrax.controls.about'), hyrax.about_path, aria: current_page?(hyrax.about_path) ? {current: 'page'} : nil %>
-
"> - <%= link_to t(:'hyrax.controls.resources'), hyku_knapsack.resources_path, aria: current_page?(hyku_knapsack.resources_path) ? {current: 'page'} : nil %> +
"> + <%= link_to t(:'hyrax.controls.help'), hyrax.help_path, aria: current_page?(hyrax.help_path) ? {current: 'page'} : nil %>
"> <%= link_to t(:'hyrax.controls.contact'), hyrax.contact_path, aria: current_page?(hyrax.contact_path) ? {current: 'page'} : nil %> diff --git a/config/initializers/bulkrax.rb b/config/initializers/bulkrax.rb index e53a3fe3..58e0a4cb 100644 --- a/config/initializers/bulkrax.rb +++ b/config/initializers/bulkrax.rb @@ -3,12 +3,9 @@ # Ensure Knapsack version gets loaded after Hyku's bulkrax.rb Rails.application.config.after_initialize do Bulkrax.setup do |config| - ## - # By default this is the first registered curation concern. But based on tests and past - # configs, this should be 'GenericWork'. Note: The below value could change, but it should be - # explicit. - # - # See https://github.com/samvera/hyku/blob/07fde572f9152d513b13f71cae90dd4fdfbfba6c/config/initializers/hyrax.rb#L200-L202 + # WorkType to use as the default if none is specified in the import + # Default is the first returned by Hyrax.config.curation_concerns + # config.default_work_type = MyWork config.default_work_type = 'GenericWork' # Setting the available parsers for Adventist. @@ -17,103 +14,18 @@ { name: "CSV - Comma Separated Values", class_name: "Bulkrax::CsvParser", partial: "csv_fields" }, ] - # Should Bulkrax make up source identifiers for you? This allow round tripping - # and download errored entries to still work, but does mean if you upload the - # same source record in two different files you WILL get duplicates. - # It is given two aruguments, self at the time of call and the index of the reocrd - # config.fill_in_blank_source_identifiers = ->(parser, index) { "b-#{parser.importer.id}-#{index}"} - # or use a uuid - # config.fill_in_blank_source_identifiers = ->(parser, index) { SecureRandom.uuid } - - # Field mappings - # Create a completely new set of mappings by replacing the whole set as follows - # config.field_mappings = { - # "Bulkrax::OaiDcParser" => { **individual field mappings go here*** } - # } + # Field to use during import to identify if the Work or Collection already exists. + # Default is 'source'. + # config.system_identifier_field = 'source' - # Add to, or change existing mappings as follows - # e.g. to exclude date - # config.field_mappings["Bulkrax::OaiDcParser"]["date"] = { from: ["date"], excluded: true } - # - # # e.g. to add the required source_identifier field - # # config.field_mappings["Bulkrax::CsvParser"]["source_id"] = { from: ["old_source_id"], source_identifier: true } - # If you want Bulkrax to fill in source_identifiers for you, see below + # Path to store pending imports + # config.import_path = 'tmp/imports' - # To duplicate a set of mappings from one parser to another - # config.field_mappings["Bulkrax::OaiOmekaParser"] = {} - # config.field_mappings["Bulkrax::OaiDcParser"].each {|key,value| config.field_mappings["Bulkrax::OaiOmekaParser"][key] = value } - config.field_mappings['Bulkrax::OaiAdventistQdcParser'] = { - 'abstract' => { from: ['abstract'] }, - 'aark_id' => { from: ['aark_id'] }, - 'identifier' => { from: ['identifier'], source_identifier: true }, - 'bibliographic_citation' => { from: ['bibliographic_citation'] }, - 'creator' => { from: ['creator'] }, - 'contributor' => { from: ['contributor'] }, - 'edition' => { from: ['edition'] }, - 'resource_type' => { from: ['resource_type'] }, - 'issue_number' => { from: ['issue_number'] }, - 'language' => { from: ['language'] }, - 'description' => { from: ['description'] }, - 'pagination' => { from: ['pagination'] }, - 'extent' => { from: ['extent'], split: ';' }, - 'source' => { from: ['source'] }, - 'date_issued' => { from: ['date_issued'] }, - 'alt' => { from: ['geocode'] }, - 'publisher' => { from: ['publisher'], split: ';' }, - 'rights_statement' => { from: ['rights_statement'] }, - 'part_of' => { from: ['part_of'] }, - 'part' => { from: ['part_of'] }, - 'date_created' => { from: ['date_created'] }, - 'title' => { from: ['title'] }, - 'subject' => { from: ['subject'], split: ';' }, - 'volume_number' => { from: ['volume_number'] }, - 'keyword' => { from: ['keyword'], split: ';' }, - 'location' => { from: ['location'], split: ';' }, - 'model' => { from: ['model', 'work_type'] }, - 'remote_files' => { from: ['related_url'], split: ';', parsed: true }, - 'thumbnail_url' => { from: ['thumbnail_url'], default_thumbnail: true, parsed: true }, - 'video_embed' => { from: ['video_embed'] }, - 'refereed' => { from: ['peer_reviewed'] } - } - config.field_mappings['Bulkrax::CsvParser'] = { - 'abstract' => { from: ['description.abstract'] }, - 'aark_id' => { from: ['identifier.ark'] }, - 'identifier' => { from: ['identifier'], source_identifier: true }, - 'bibliographic_citation' => { from: ['identifier.bibliographicCitation'] }, - 'creator' => { from: ['creator'], split: ';' }, - 'contributor' => { from: ['contributor'], split: ';' }, - 'edition' => { from: ['title.release'] }, - 'resource_type' => { from: ['type'] }, - 'issue_number' => { from: ['relation.isPartOfIssue'] }, - 'language' => { from: ['language'], split: ';' }, - 'description' => { from: ['description'], split: ';' }, - 'pagination' => { from: ['format.extent'] }, - 'extent' => { from: ['format.extent'], split: ';' }, - 'source' => { from: ['source'], split: ';' }, - 'date_issued' => { from: ['date'] }, - 'alt' => { from: ['coverage.spatial'] }, - 'publisher' => { from: ['publisher'], split: ';' }, - 'rights_statement' => { from: ['rights'] }, - 'part_of' => { from: ['relation.isPartOf'], split: ';' }, - 'part' => { from: ['relation.isPartOf'] }, - 'date_created' => { from: ['date.other'] }, - 'title' => { from: ['title'] }, - 'subject' => { from: ['subject'], split: ';' }, - 'volume_number' => { from: ['relation.isPartOfVolume'] }, - 'keyword' => { from: ['keyword'], split: ';' }, - 'location' => { from: ['location'], split: ';' }, - 'model' => { from: ['work_type'] }, - 'remote_files' => { from: ['related_url'], split: ';', parsed: true }, - 'remote_url' => { from: ['official_url', 'remote_url'], split: ';' }, - 'thumbnail_url' => { from: ['thumbnail_url'], default_thumbnail: true, parsed: true }, - 'video_embed' => { from: ['video_embed'] }, - 'refereed' => { from: ['peer_reviewed'] } - } + # Path to store exports before download + # config.export_path = 'tmp/exports' - config.field_mappings['Bulkrax::CsvParser'].merge!( - 'parents' => { from: ['parents'], split: /\s*[;|]\s*/, related_parents_field_mapping: true }, - 'children' => { from: ['children'], split: /\s*[;|]\s*/, related_children_field_mapping: true } - ) + # Server name for oai request header + # config.server_name = 'my_server@name.com' # Lambda to set the default field mapping config.default_field_mapping = lambda do |field| @@ -130,41 +42,5 @@ } } end - - # WorkType to use as the default if none is specified in the import - # Default is the first returned by Hyrax.config.curation_concerns - # config.default_work_type = MyWork - - # Path to store pending imports - # config.import_path = 'tmp/imports' - - # Path to store exports before download - # config.export_path = 'tmp/exports' - - # Server name for oai request header - # config.server_name = 'my_server@name.com' - - # Field_mapping for establishing a parent-child relationship (FROM parent TO child) - # This can be a Collection to Work, or Work to Work relationship - # This value IS NOT used for OAI, so setting the OAI Entries here will have no effect - # The mapping is supplied per Entry, provide the full class name as a string, eg. 'Bulkrax::CsvEntry' - # Example: - # { - # 'Bulkrax::RdfEntry' => 'http://opaquenamespace.org/ns/contents', - # 'Bulkrax::CsvEntry' => 'children' - # } - # By default no parent-child relationships are added - # config.parent_child_field_mapping = { } - - # Field_mapping for establishing a collection relationship (FROM work TO collection) - # This value IS NOT used for OAI, so setting the OAI parser here will have no effect - # The mapping is supplied per Entry, provide the full class name as a string, eg. 'Bulkrax::CsvEntry' - # The default value for CSV is collection - # Add/replace parsers, for example: - # config.collection_field_mapping['Bulkrax::RdfEntry'] = 'http://opaquenamespace.org/ns/set' - - # Properties that should not be used in imports/exports. They are reserved for use by Hyrax. - # config.reserved_properties += ['my_field'] - end end diff --git a/config/initializers/default_bulkrax_mappings.rb b/config/initializers/default_bulkrax_mappings.rb new file mode 100644 index 00000000..fe3d5a18 --- /dev/null +++ b/config/initializers/default_bulkrax_mappings.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +mappings = {} + +## Set custom bulkrax parser field mappings for app +mappings["Bulkrax::OaiAdventistQdcParser"] = { + 'abstract' => { from: ['abstract'] }, + 'aark_id' => { from: ['aark_id'] }, + 'identifier' => { from: ['identifier'], source_identifier: true }, + 'bibliographic_citation' => { from: ['bibliographic_citation'] }, + 'creator' => { from: ['creator'] }, + 'contributor' => { from: ['contributor'] }, + 'edition' => { from: ['edition'] }, + 'resource_type' => { from: ['resource_type'] }, + 'issue_number' => { from: ['issue_number'] }, + 'language' => { from: ['language'] }, + 'description' => { from: ['description'] }, + 'pagination' => { from: ['pagination'] }, + 'extent' => { from: ['extent'], split: ';' }, + 'source' => { from: ['source'] }, + 'date_issued' => { from: ['date_issued'] }, + 'alt' => { from: ['geocode'] }, + 'publisher' => { from: ['publisher'], split: ';' }, + 'rights_statement' => { from: ['rights_statement'] }, + 'part_of' => { from: ['part_of'] }, + 'part' => { from: ['part_of'] }, + 'date_created' => { from: ['date_created'] }, + 'title' => { from: ['title'] }, + 'subject' => { from: ['subject'], split: ';' }, + 'volume_number' => { from: ['volume_number'] }, + 'keyword' => { from: ['keyword'], split: ';' }, + 'location' => { from: ['location'], split: ';' }, + 'model' => { from: ['model', 'work_type'] }, + 'remote_files' => { from: ['related_url'], split: ';', parsed: true }, + 'thumbnail_url' => { from: ['thumbnail_url'], default_thumbnail: true, parsed: true }, + 'video_embed' => { from: ['video_embed'] }, + 'refereed' => { from: ['peer_reviewed'] } +} +mappings["Bulkrax::CsvParser"] = { + 'abstract' => { from: ['description.abstract'] }, + 'aark_id' => { from: ['identifier.ark'] }, + 'identifier' => { from: ['identifier'], source_identifier: true }, + 'bibliographic_citation' => { from: ['identifier.bibliographicCitation'] }, + 'creator' => { from: ['creator'], split: ';' }, + 'contributor' => { from: ['contributor'], split: ';' }, + 'edition' => { from: ['title.release'] }, + 'resource_type' => { from: ['type'] }, + 'issue_number' => { from: ['relation.isPartOfIssue'] }, + 'language' => { from: ['language'], split: ';' }, + 'description' => { from: ['description'], split: ';' }, + 'pagination' => { from: ['format.extent'] }, + 'extent' => { from: ['format.extent'], split: ';' }, + 'source' => { from: ['source'], split: ';' }, + 'date_issued' => { from: ['date'] }, + 'alt' => { from: ['coverage.spatial'] }, + 'publisher' => { from: ['publisher'], split: ';' }, + 'rights_statement' => { from: ['rights'] }, + 'part_of' => { from: ['relation.isPartOf'], split: ';' }, + 'part' => { from: ['relation.isPartOf'] }, + 'date_created' => { from: ['date.other'] }, + 'title' => { from: ['title'] }, + 'subject' => { from: ['subject'], split: ';' }, + 'volume_number' => { from: ['relation.isPartOfVolume'] }, + 'keyword' => { from: ['keyword'], split: ';' }, + 'location' => { from: ['location'], split: ';' }, + 'model' => { from: ['work_type'] }, + 'remote_files' => { from: ['related_url'], split: ';', parsed: true }, + 'remote_url' => { from: ['official_url', 'remote_url'], split: ';' }, + 'thumbnail_url' => { from: ['thumbnail_url'], default_thumbnail: true, parsed: true }, + 'video_embed' => { from: ['video_embed'] }, + 'refereed' => { from: ['peer_reviewed'] }, + 'parents' => { from: ['parents'], split: /\s*[;|]\s*/, related_parents_field_mapping: true }, + 'children' => { from: ['children'], split: /\s*[;|]\s*/, related_children_field_mapping: true } +} + +Hyku.default_bulkrax_field_mappings = mappings diff --git a/config/locales/hyrax.en.yml b/config/locales/hyrax.en.yml index 43545412..3c6f665d 100644 --- a/config/locales/hyrax.en.yml +++ b/config/locales/hyrax.en.yml @@ -499,7 +499,6 @@ en: about: About contact: Contact help: Help - resources: Other Resources home: Home dashboard: additional_notifications: See all notifications @@ -920,7 +919,6 @@ en: agreement_page: Deposit Agreement help_page: Help Page terms_page: Terms of Use - resources_page: Other Resources updated: Pages updated. passive_consent_to_agreement: By saving this work I agree to the search: diff --git a/config/routes.rb b/config/routes.rb index 45717926..de7a427e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true HykuKnapsack::Engine.routes.draw do mount Hyrax::Engine, at: '/' - get 'resources' => 'pages#show', key: 'resources' mount IiifPrint::Engine, at: '/' end diff --git a/docker-compose.yml b/docker-compose.yml index ff04993f..683fb932 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -121,6 +121,9 @@ services: web: <<: *app + extends: + file: hyrax-webapp/docker-compose.yml + service: web # Uncomment command to access container with out starting bin/web. Useful for debugging or updating Gemfile.lock # command: sleep infinity environment: diff --git a/hyrax-webapp b/hyrax-webapp index 2f9dd853..bf83f243 160000 --- a/hyrax-webapp +++ b/hyrax-webapp @@ -1 +1 @@ -Subproject commit 2f9dd8532ea46ba3a2cde5505775f4fd835b6f60 +Subproject commit bf83f243724943c28116f4c0a37ed4b200d794c0 diff --git a/spec/controllers/hyrax/hyrax/admin/appearances_controller_spec.rb b/spec/controllers/hyrax/hyrax/admin/appearances_controller_spec.rb deleted file mode 100644 index e0c57526..00000000 --- a/spec/controllers/hyrax/hyrax/admin/appearances_controller_spec.rb +++ /dev/null @@ -1,80 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Hyrax::Admin::AppearancesController, type: :controller, singletenant: true do - before { sign_in user } - - routes { Hyrax::Engine.routes } - - context 'with an unprivileged user' do - let(:user) { create(:user) } - - describe "GET #show" do - it "denies the request" do - get :show - expect(response).to have_http_status(:unauthorized) - end - end - - describe "PUT #update" do - it "denies the request" do - put :update - expect(response).to have_http_status(:unauthorized) - end - end - end - - context 'with an administrator' do - let(:user) { create(:admin) } - - describe "GET #show" do - it "assigns the requested site as @site" do - get :show, params: {} - expect(response).to be_successful - end - end - - describe "PUT #update" do - let(:hyrax) { routes.url_helpers } - - context "with valid params" do - let(:valid_attributes) do - { banner_image: "image.jpg", directory_image: "image.jpg" } - end - - it "sets a banner image" do - expect(Site.instance.banner_image?).to be false - f = fixture_file_upload('/images/nypl-hydra-of-lerna.jpg', 'image/jpg') - post :update, params: { admin_appearance: { banner_image: f } } - expect(response).to redirect_to(hyrax.admin_appearance_path(locale: 'en')) - expect(flash[:notice]).to include("The appearance was successfully updated") - expect(Site.instance.banner_image?).to be true - end - - it "sets a directory image" do - expect(Site.instance.directory_image?).to be false - f = fixture_file_upload('/images/nypl-hydra-of-lerna.jpg', 'image/jpg') - post :update, params: { admin_appearance: { directory_image: f } } - expect(response).to redirect_to(hyrax.admin_appearance_path(locale: 'en')) - expect(flash[:notice]).to include("The appearance was successfully updated") - expect(Site.instance.directory_image?).to be true - end - - it "redirects to the site" do - put :update, params: { admin_appearance: valid_attributes } - expect(response).to redirect_to(hyrax.admin_appearance_path(locale: 'en')) - end - end - - context "with invalid params" do - let(:invalid_attributes) do - { banner_image: "" } - end - - it "re-renders the 'show' template" do - put :update, params: { admin_appearance: invalid_attributes } - expect(response).to redirect_to(action: "show") - end - end - end - end -end