-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from scientist-softserv/i564-create-various-wor…
…k-types I564 create various work types
- Loading branch information
Showing
16 changed files
with
116 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
Hyrax::GenericWorkForm.terms += %i[ | ||
aark_id | ||
abstract | ||
alt | ||
bibliographic_citation | ||
date_issued | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
Hyrax::ImageForm.terms += %i[ | ||
aark_id | ||
abstract | ||
alt | ||
bibliographic_citation | ||
date_issued | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
module ImageDecorator | ||
extend ActiveSupport::Concern | ||
include ::Hyrax::WorkBehavior | ||
include SlugBug | ||
include DogBiscuits::Abstract | ||
include DogBiscuits::BibliographicCitation | ||
include DogBiscuits::DateIssued | ||
include DogBiscuits::Geo | ||
include DogBiscuits::PartOf | ||
include DogBiscuits::PlaceOfPublication | ||
include IiifPrint.model_configuration( | ||
Image.include(::Hyrax::WorkBehavior) | ||
Image.include(SlugBug) | ||
Image.include(DogBiscuits::Abstract) | ||
Image.include(DogBiscuits::BibliographicCitation) | ||
Image.include(DogBiscuits::DateIssued) | ||
Image.include(DogBiscuits::Geo) | ||
Image.include(DogBiscuits::PartOf) | ||
Image.include(DogBiscuits::PlaceOfPublication) | ||
Image.include(IiifPrint.model_configuration( | ||
pdf_split_child_model: self, | ||
pdf_splitter_service: IiifPrint::SplitPdfs::AdventistPagesToJpgsSplitter, | ||
derivative_service_plugins: [ | ||
IiifPrint::TextExtractionDerivativeService | ||
] | ||
) | ||
end | ||
)) | ||
|
||
Image.prepend ImageDecorator | ||
# This must come after the properties because it finalizes the metadata | ||
# schema (by adding accepts_nested_attributes) | ||
Image.include SlugMetadata | ||
Image.include AdventistMetadata | ||
|
||
Image.instance_variable_set(:@generated_resource_class, nil) | ||
Image.resource_class.send(:include, AdventistMetadata) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# frozen_string_literal: true | ||
|
||
# The main purpose of these overrides is to handle multiple authorities directories. | ||
# Questioning Authority gem only allows one directory for local authorities, which by | ||
# default is looking at the Hyku's `config/authorities directory` instead of Knapsack's | ||
# `config/authorities` directory. | ||
# | ||
# We want have the ability to add HykuKnapsack's authorities directory in addition to | ||
# Hyku's. If two are of the same name, then the one in HykuKnapsack should override the | ||
# one in Hyku. | ||
|
||
# Using relative path because when this gets called we are in the submodule | ||
HykuKnapsack::AUTHORITIES_PATH = File.expand_path('../config/authorities', Rails.root) | ||
|
||
module Qa | ||
module Authorities | ||
# OVERRIDE Questioning Authority v5.10.0 to load knapsack authorities | ||
# see: https://github.com/samvera/questioning_authority/blob/14d233a8404a8d805f1213ae9431ad4ff82a9937/lib/qa/authorities/local.rb | ||
module LocalDecorator | ||
# Overidding to handle to return an array of paths | ||
def subauthorities_path(knapsack_authorities_path: HykuKnapsack::AUTHORITIES_PATH) | ||
# knapsack_authorities_path should be first to allow for overriding in case of duplicate names | ||
authorities_paths = [knapsack_authorities_path, config[:local_path]] | ||
|
||
authorities_paths.map do |path| | ||
path if File.directory?(path) | ||
end.compact | ||
end | ||
|
||
# Overriding to handle an array of paths to return names of all files | ||
def names | ||
paths = subauthorities_path # Assuming this now returns an array | ||
all_names = [] | ||
|
||
paths.each do |path| | ||
unless Dir.exist? path | ||
raise Qa::ConfigDirectoryNotFound, | ||
"There's no directory at #{path}. You must create it in order to use local authorities" | ||
end | ||
|
||
all_names += Dir.entries(path).map { |f| File.basename(f, '.yml') if f =~ /yml$/ }.compact | ||
end | ||
|
||
all_names.uniq | ||
end | ||
end | ||
end | ||
end | ||
|
||
module Qa | ||
module Authorities | ||
module Local | ||
# OVERRIDE Questioning Authority v5.10.0 to return first file found from an array of paths | ||
# see: https://github.com/samvera/questioning_authority/blob/14d233a8404a8d805f1213ae9431ad4ff82a9937/lib/qa/authorities/local/file_based_authority.rb | ||
module FileBasedAuthorityDecorator | ||
def subauthority_filename | ||
subauthorities_paths = Local.subauthorities_path | ||
|
||
subauthorities_paths.each do |path| | ||
yaml_file = File.join(path, "#{subauthority}.yml") | ||
return yaml_file if File.exist?(yaml_file) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Qa::Authorities::Local.singleton_class.send(:prepend, Qa::Authorities::LocalDecorator) | ||
Qa::Authorities::Local::FileBasedAuthority.prepend(Qa::Authorities::Local::FileBasedAuthorityDecorator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters