- 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_ssimas 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_idfield. 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_idfield to admins only. This institutes a single-valued pull-down filled with all Collection objects.
- The Collection facet field now uses
source_collection_title_ssimas it's filter value.
- This only overrides the
#collection_type_paramsmethod fromHyrax::Admin::CollectionTypesController, adding:deposit_only_collectioninto the permitted params.
- The
scssbetween lines 103 and 106 adjusts the padding and margin for the Source Collection link on Collection show pages.
Hyrax::Forms::Admin::CollectionTypeFormhad to be overridden so that:deposit_only_collectioncould be delegated to:collection_type.
:source_collection_idand:deposit_collection_idshad to be added to thetermsandsecondary_termsarrays, since it feeds the logic that automatically generates Collection's new/edit input fields.
:source_collection_idhad to be added to thetermsandprimary_admin_metadata_fieldsarrays, since it feeds the logic that automatically generates Works' new/edit input fields.
#collection_linkdynamically creates the right link based upon whether the user's on the Dashboard or the public Collection show page.
#all_collections_collectioncreates 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_idis added toCURATE_TERMS_MAPso that it is expected and accepted during CSV imports.
- Curate's Product Owner specified that
source_collection_idshould be on the processed CSV output, even if it is not present on the input file. Theexclusion_guardmethod was applied to the@merged_headersinstance variable so that it is inserted if not found in the@source_csv.headers.
source_collection_idis 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_ssimanddeposit_collection_titles_tesim: both of these fields are stubbed with the:titleattribute associated to the object's respective Source and Deposit Collection values.deposit_collection_ids_tesim: declared here to ensuresolr_documentobjects carry the Deposit Collection IDs over.
#collection_works: with the search originally focused on:member_of_collection_ids_ssimto 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:titleand:id.#deposit_collection_ids: pulls the needed Deposit Collection IDs from thesolr_document.#deposit_collections: creates an array of hashes, each containing the:titleand:idof every Deposit Collection associated to the object.
:source_collection_titleis delegated to the:solr_documentso thatpresenter.source_collection_titlecalls 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_collectioncould 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_blacklightgrid and add in a facet labeled "Source Collection" onto the Works index.
- In order to overwrite
Hyrax::Admin::CollectionTypesControllereffectively, we have toprependCollectionTypesControllerOverrideonto it here.
- Added
:deposit_only_collectiononto the:hyrax_collection_typestable so future Collections can have a Deposit-Only CollectionType.