Skip to content

Commit

Permalink
HYC-1739 - Blacklight class overrides (#996)
Browse files Browse the repository at this point in the history
* Change facets_helper_behavior to an override

* Remove override of facets_helper_behavior since we don't display individual date values in the facet, so there's no reason to format them

* Add test for dublin core overrides

* Convert dublin_core.rb to an override

* Add override url

* Deleting solr_document_wrapper.rb override, the override was no longer needed since upstream they addressed the security issue where you could retrieve private records via oai get projectblacklight/blacklight_oai_provider#27

* Remove commented out code

* Fix and clarify test messages
  • Loading branch information
bbpennel authored Sep 12, 2023
1 parent c088be3 commit 2a62158
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 413 deletions.
250 changes: 0 additions & 250 deletions app/helpers/blacklight/facets_helper_behavior.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
# [hyc-override] override file from blacklight gem
# frozen_string_literal: true

require 'builder'

# This module provides Dublin Core export based on the document's semantic values
module Blacklight::Document::DublinCore
# [hyc-override] https://github.com/projectblacklight/blacklight/tree/v7.33.1/app/models/concerns/blacklight/document/dublin_core.rb
Blacklight::Document::DublinCore.module_eval do
include HycHelper

def self.extended(document)
# Register our exportable formats
Blacklight::Document::DublinCore.register_export_formats(document)
end

def self.register_export_formats(document)
document.will_export_as(:xml)
document.will_export_as(:dc_xml, 'text/xml')
document.will_export_as(:oai_dc_xml, 'text/xml')
end

# added thumbnail as separate field to help with ordering
# [hyc-override] added thumbnail as separate field to help with ordering
def dublin_core_field_names
[:contributor, :coverage, :creator, :date, :description, :format, :identifier, :language, :publisher, :relation,
:rights, :source, :subject, :title, :type, :thumbnail]
Expand Down Expand Up @@ -80,18 +65,9 @@ def export_as_oai_dc_xml
xml.target!
end

alias_method :export_as_xml, :export_as_oai_dc_xml
alias_method :export_as_dc_xml, :export_as_oai_dc_xml

# Used by ruby-oai gem to determine if a status=deleted header should be added.
# [hyc-override] Used by ruby-oai gem to determine if a status=deleted header should be added.
# See OAI::Provider::Response::RecordResponse
def deleted?
fetch('workflow_state_name_ssim', nil)&.include?('withdrawn')
end

private

def dublin_core_field_name?(field)
dublin_core_field_names.include? field.to_sym
end
end
96 changes: 0 additions & 96 deletions lib/blacklight_oai_provider/solr_document_wrapper.rb

This file was deleted.

Loading

0 comments on commit 2a62158

Please sign in to comment.