- Overview
- Models
- Views
- Controllers
- Assets
- Forms
- Helpers
- Importers
- Indexers
- Jobs
- Presenters
- Search Builders
- Initializers
- Config
- DB/Migrate
Just after the launch of Curate v1, it was determined that the greater the number of Works that are associated with a single Collection, the longer that any further ingestions of Works to that Collection would take. The best solution to this issue was to create, in essence, sub-containers for each primary Collection. The original Collection would take on the moniker of "Source", while the secondary collections would be deemed "Deposit". Works would hold associations to both their direct and overarching parents (sometimes the same Collection). Several customizations upon our Hyrax backbone were needed to implement the parent/child relationships. Below, you will find descriptions of these changes grouped by class and module types.
:deposit_collection_ids
: this multi-value attribute was added to retain all of the child collection IDs that are associated to a Collection instance. The presence of IDs in an instance means that it is a Source Collection.:source_collection_id
: a single-valued field that holds the parent collection ID. An ID populated in this field means that object is a Deposit Collection.
:source_collection_id
: this required field ties the Work to the Source Collection with an ID string.
#source_collection_title
: a method allowing the SolrDocument rails object to access the value ofsource_collection_title_ssim
as if it were stored in ActiveRecord.
- A checkbox is inserted at line 41 to give a new CollectionType the option of being deposit-only.
- On lines 17 through 25, a Source Collection header and link is added to this Work show page partial.
- This is a new partial that inserts a header and Deposit Collection link(s) for a Source Collection's show pages.
- This is a new partial that inserts a header and Source Collection link for a Deposit Collection's show pages.
- Between lines 98 and 102, inserts partial calls to both the Deposit and Source Collection links
html
.
- This Hyrax page overwrite only reflects changes between lines 64 and 76. Here, we are inserting two partial calls to the Deposit and Source Collection links
html
.
- A partial that effectively overrides Hyrax/Simple Form's default input tag so that only admins can adjust the
deposit_collection_id
field. Also institutes a multi-valued pull-down filled with all Collection objects.
- Another override of Hyrax/Simple Form's default input tag that restricts the
source_collection_id
field to admins only. This institutes a single-valued pull-down filled with all Collection objects.
- The Collection facet field now uses
source_collection_title_ssim
as it's filter value.
- This only overrides the
#collection_type_params
method fromHyrax::Admin::CollectionTypesController
, adding:deposit_only_collection
into the permitted params.
- The
scss
between lines 103 and 106 adjusts the padding and margin for the Source Collection link on Collection show pages.
Hyrax::Forms::Admin::CollectionTypeForm
had to be overridden so that:deposit_only_collection
could be delegated to:collection_type
.
:source_collection_id
and:deposit_collection_ids
had to be added to theterms
andsecondary_terms
arrays, since it feeds the logic that automatically generates Collection's new/edit input fields.
:source_collection_id
had to be added to theterms
andprimary_admin_metadata_fields
arrays, since it feeds the logic that automatically generates Works' new/edit input fields.
#collection_link
dynamically creates the right link based upon whether the user's on the Dashboard or the public Collection show page.
#all_collections_collection
creates an array of arrays each containing Collection object's titles and ids. This supplies the select fields' collection attributes in the Collection new/edit forms.
source_collection_id
is added toCURATE_TERMS_MAP
so that it is expected and accepted during CSV imports.
- Curate's Product Owner specified that
source_collection_id
should be on the processed CSV output, even if it is not present on the input file. Theexclusion_guard
method was applied to the@merged_headers
instance variable so that it is inserted if not found in the@source_csv.headers
.
source_collection_id
is inserted intoHEADER_FIELDS
, so that the field is included in the output file, andpull_list_mappings
, in order for the values to be pulled from the input CSV.
source_collection_title_for_collections_ssim
anddeposit_collection_titles_tesim
: both of these fields are stubbed with the:title
attribute associated to the object's respective Source and Deposit Collection values.deposit_collection_ids_tesim
: declared here to ensuresolr_document
objects carry the Deposit Collection IDs over.
#collection_works
: with the search originally focused on:member_of_collection_ids_ssim
to match with the currentcollection_id
, this had to swap out to:source_collection_id_tesim
.#source_collections
: this logic had to be added so that the focus shifted to Collections with CollectionTypes not set to Deposit-Only.
The following methods were added to the Presenter so that Deposit and Source Collection details could pass over to the Collection views
#deposit_collection?
: this is a boolean method that returns true if the object is a Deposit Collection.#source_collection_object
: returns a hash of Source Collection:title
and:id
.#deposit_collection_ids
: pulls the needed Deposit Collection IDs from thesolr_document
.#deposit_collections
: creates an array of hashes, each containing the:title
and:id
of every Deposit Collection associated to the object.
:source_collection_title
is delegated to the:solr_document
so thatpresenter.source_collection_title
calls won't look for a method created within the class.
- This class was pulled in as an overwrite of Hyrax' class so that
#member_of_collection
could include Collections' associated Deposit Collection Works alongside the Source Collection Works.
self.configure_facets
: this method is created and called so it can tap into the originalconfigure_blacklight
grid and add in a facet labeled "Source Collection" onto the Works index.
- In order to overwrite
Hyrax::Admin::CollectionTypesController
effectively, we have toprepend
CollectionTypesControllerOverride
onto it here.
- Added
:deposit_only_collection
onto the:hyrax_collection_types
table so future Collections can have a Deposit-Only CollectionType.