-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begins to integrate the form functionality for the EphemeraBox and Ep…
…hemeraFolder resources within EphemeraProjects Adding routing and minimal support for EphemeraFolders Implementing a first attempt at supporting EphemeraBox membership and improving the routes for EphemeraBoxes and EphemeraFolders Ensuring that Resources can have IIIF Manifests exposed using the class method "can_have_manifests?"; Ensuring that EphemeraProjects and EphemeraBoxes are linked using the ContextualPath Implementing the attributes for the EphemeraFolders; Resolving issues for ScannedResources Integrating support for membership within EphemeraFolders Tracking files being merge after the latest rebase Adding the Factories and test suites for the Ephemera Decorators Extending the test coverage for the Ephemera* Controllers and Decorators Extending the test coverage for EphemeraFolder and EphemeraField Controllers; Adding the routes for EphemeraFields Don't create a real property for append_id Append_id is a virtual property in Valkyrie that exists on ChangeSets. It's not something we want to persist - it's something we act on in a ChangeSetPersister. Increasing the coverage for the EphemeraFolderDecorator Use Blacklight's type filter for members. Works better than a branch in the default view. Fix discoverability of EphemeraFolders. Extending the coverage for the Ephemera Decorators; Adding test coverage for the EphemeraBox and Folder ChangeSets Increasing (and improving upon) the Ephemera Controllers Increasing the test coverage for EphemeraFolders and the ephemera editor role Clean up box show view. Ensures that IIIF Manifests are properly structured for EphemeraFolders Add parent breadcrumb for boxes. Add Ephemera Folder Workflow Also DRYs this up a bit to make it easier to add another workflow later. Rename project `name` to `title` Fixes the header. Add home page links for Ephemera. Hide Project attributes. Implement Box Workflow. Improve parent breadcrumb for folders. Fix visibility default. Show workflow state. Hide thumbnail from show page. Add Plum Folder Javascript Adds datatables when appropriate and handles sort title. Ensure folders are always displayable. Fix discovery/manifest of Folders. Removing an unreachable condition branch for manifest access permissions
- Loading branch information
1 parent
9394dcb
commit 00a2e31
Showing
86 changed files
with
2,648 additions
and
114 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
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,20 @@ | ||
/* ephemera sort title: generate a sort title when the title or language is updated */ | ||
var articles = { | ||
'English': ['a', 'an', 'the'], | ||
'Portuguese': ['as', 'um', 'uma', 'umas', 'uns'], | ||
'Spanish': ['el', 'la', 'las', 'los', 'o', 'os'] | ||
}; | ||
|
||
$(document).ready(function(){ | ||
$('input[id="ephemera_folder_title"]').change(sort_title); | ||
$('select[id="ephemera_folder_language"]').change(sort_title); | ||
}); | ||
|
||
function sort_title() { | ||
var sort_title = $('#ephemera_folder_title').val().toLowerCase(); | ||
var lang = $('#ephemera_folder_language').find(':selected').filter(':first').text(); | ||
if (lang in articles) { | ||
sort_title = sort_title.replace(new RegExp('^(' + articles[lang].join('|') + ')\\s'), ''); | ||
} | ||
$('#ephemera_folder_sort_title').val(sort_title); | ||
} |
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,47 @@ | ||
# frozen_string_literal: true | ||
class EphemeraBoxChangeSet < Valhalla::ChangeSet | ||
apply_workflow BoxWorkflow | ||
validates :barcode, :box_number, :visibility, :rights_statement, presence: true | ||
property :barcode, multiple: false, required: true | ||
property :box_number, multiple: false, required: true | ||
property :shipped_date, multiple: false, required: false | ||
property :tracking_number, multiple: false, required: false | ||
property :member_ids, multiple: true, required: false, type: Types::Strict::Array.member(Valkyrie::Types::ID) | ||
property :member_of_collection_ids, multiple: true, required: false, type: Types::Strict::Array.member(Valkyrie::Types::ID) | ||
property :visibility, multiple: false, default: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC | ||
property :read_groups, multiple: true, required: false | ||
property :rights_statement, multiple: false, required: true, default: "http://rightsstatements.org/vocab/NKC/1.0/", type: ::Types::URI | ||
property :rights_note, multiple: false, required: false | ||
delegate :human_readable_type, to: :model | ||
validate :barcode_valid? | ||
|
||
def barcode_valid? | ||
# return if barcode.present? && barcode.first.match(/^\d+{14}$/) | ||
return if Barcode.new(Array.wrap(barcode).first).valid? | ||
errors.add(:barcode, 'has an invalid checkdigit') | ||
end | ||
|
||
def primary_terms | ||
[ | ||
:barcode, | ||
:box_number, | ||
:shipped_date, | ||
:tracking_number, | ||
:member_of_collection_ids, | ||
:append_id | ||
] | ||
end | ||
|
||
def visibility=(visibility) | ||
super.tap do |_result| | ||
case visibility | ||
when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC | ||
self.read_groups = [Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC] | ||
when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED | ||
self.read_groups = [Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED] | ||
when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE | ||
self.read_groups = [] | ||
end | ||
end | ||
end | ||
end |
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,9 @@ | ||
# frozen_string_literal: true | ||
class EphemeraFieldChangeSet < Valkyrie::ChangeSet | ||
validates :name, presence: true | ||
property :name, multiple: false | ||
|
||
def primary_terms | ||
[:name] | ||
end | ||
end |
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,83 @@ | ||
# frozen_string_literal: true | ||
class EphemeraFolderChangeSet < Valhalla::ChangeSet | ||
apply_workflow(FolderWorkflow) | ||
validates :barcode, :folder_number, :title, :language, :genre, :width, :height, :page_count, :visibility, :rights_statement, presence: true | ||
validates_with StateValidator | ||
property :barcode, multiple: false, required: true | ||
property :folder_number, multiple: false, required: true | ||
property :title, multiple: false, required: true | ||
property :sort_title, required: false | ||
property :alternative_title, multiple: true, required: false | ||
property :language, multiple: true, required: true | ||
property :genre, multiple: false, required: true | ||
property :width, multiple: false, required: true | ||
property :height, multiple: false, required: true | ||
property :page_count, multiple: false, required: true | ||
property :series, multiple: false, required: false | ||
property :creator, required: false | ||
property :contributor, multiple: true, required: false | ||
property :publisher, multiple: true, required: false | ||
property :geographic_origin, required: false | ||
property :subject, multiple: true, required: false | ||
property :geo_subject, multiple: true, required: false | ||
property :description, required: false | ||
property :date_created, required: false | ||
property :dspace_url, required: false | ||
property :source_url, required: false | ||
property :rights_statement, multiple: false, required: true, default: "http://rightsstatements.org/vocab/NKC/1.0/", type: ::Types::URI | ||
property :rights_note, multiple: false, required: false | ||
property :thumbnail_id, multiple: false, required: false, type: Valkyrie::Types::ID | ||
property :member_of_collection_ids, multiple: true, required: false, type: Types::Strict::Array.member(Valkyrie::Types::ID) | ||
property :read_groups, multiple: true, required: false | ||
property :files, virtual: true, multiple: true, required: false | ||
property :pending_uploads, multiple: true, required: false | ||
|
||
property :start_canvas, required: false | ||
property :viewing_direction, required: false | ||
property :viewing_hint, multiple: false, required: false, default: "individuals" | ||
|
||
property :visibility, multiple: false, default: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC | ||
|
||
delegate :human_readable_type, to: :model | ||
|
||
def primary_terms | ||
[ | ||
:barcode, | ||
:folder_number, | ||
:title, | ||
:sort_title, | ||
:alternative_title, | ||
:language, | ||
:genre, | ||
:width, | ||
:height, | ||
:page_count, | ||
:rights_statement, | ||
:series, | ||
:creator, | ||
:contributor, | ||
:publisher, | ||
:geographic_origin, | ||
:subject, | ||
:geo_subject, | ||
:description, | ||
:date_created, | ||
:dspace_url, | ||
:source_url, | ||
:append_id | ||
] | ||
end | ||
|
||
def visibility=(visibility) | ||
super.tap do |_result| | ||
case visibility | ||
when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC | ||
self.read_groups = [Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC] | ||
when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED | ||
self.read_groups = [Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED] | ||
when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE | ||
self.read_groups = [] | ||
end | ||
end | ||
end | ||
end |
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,10 @@ | ||
# frozen_string_literal: true | ||
class EphemeraProjectChangeSet < Valkyrie::ChangeSet | ||
validates :title, presence: true | ||
property :title, multiple: false | ||
property :member_ids, multiple: true, required: false, type: Types::Strict::Array.member(Valkyrie::Types::ID) | ||
|
||
def primary_terms | ||
[:title] | ||
end | ||
end |
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,18 @@ | ||
# frozen_string_literal: true | ||
class EphemeraBoxesController < ApplicationController | ||
include Valhalla::ResourceController | ||
include TokenAuth | ||
self.change_set_class = DynamicChangeSet | ||
self.resource_class = EphemeraBox | ||
self.change_set_persister = ::PlumChangeSetPersister.new( | ||
metadata_adapter: Valkyrie::MetadataAdapter.find(:indexing_persister), | ||
storage_adapter: Valkyrie.config.storage_adapter | ||
) | ||
before_action :load_collections, only: [:new, :edit] | ||
|
||
private | ||
|
||
def load_collections | ||
@collections = query_service.find_all_of_model(model: Collection).map(&:decorate) | ||
end | ||
end |
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,11 @@ | ||
# frozen_string_literal: true | ||
class EphemeraFieldsController < ApplicationController | ||
include Valhalla::ResourceController | ||
include TokenAuth | ||
self.change_set_class = DynamicChangeSet | ||
self.resource_class = EphemeraField | ||
self.change_set_persister = ::PlumChangeSetPersister.new( | ||
metadata_adapter: Valkyrie::MetadataAdapter.find(:indexing_persister), | ||
storage_adapter: Valkyrie.config.storage_adapter | ||
) | ||
end |
Oops, something went wrong.