Skip to content

✨ Multi-select + typeahead roles; typeahead for large controlled vocabs (#92, #93)#119

Merged
ShanaLMoore merged 2 commits into
mainfrom
i92-role-multiselect-typeahead
Jul 20, 2026
Merged

✨ Multi-select + typeahead roles; typeahead for large controlled vocabs (#92, #93)#119
ShanaLMoore merged 2 commits into
mainfrom
i92-role-multiselect-typeahead

Conversation

@ShanaLMoore

@ShanaLMoore ShanaLMoore commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Enables multi-select + typeahead on contributor roles, and typeahead on large controlled vocabularies (SPDX licenses, rights statements, relationship types) in the deposit/edit forms.

Closes #92 (contributors can hold multiple roles per work)
Closes #93 (typeahead for metadata fields with large value lists)

Builds on samvera/hyrax#7540 (compound controlled-field multi-select/typeahead), pulled in via the Hyku submodule bump in this branch.

Changes

config/metadata_profiles/m3_profile.yamlform: opt-ins on compound controlled sub-properties:

Field Authority ~Terms Opt-in
contributor_role contributor_roles ~390 multiple: true + autocomplete: true
license licenses (SPDX) ~1,450 autocomplete: true
rights_statement rights_statements ~12 autocomplete: true
relationship_type relationship_types ~44 autocomplete: true
date_type inline (11) 11 left as plain dropdown

app/services/enact/work_contributors.rb, contributor_graph.rbrole is now multi-value (array per compound row, superseding the old one-row-per-role storage), so both readers Array()-flatten each entry's roles. Backward-compatible with legacy single-string entries (PeopleGraph already wrapped with Array()). Multi-role coverage added to both specs.

Verification

Rubocop clean; the two service specs pass in-container. Verified end-to-end in the browser (dev tenant, Hyrax d431073): role field renders as a select2 multi-select typeahead, license filters the full SPDX list, and a saved multi-role contributor renders once on the show page with both roles joined.

⚠️ After bumping the Hyrax gem, precompiled assets must be regenerated (assets:precompile) and puma restarted, or the new select2 binding JS won't be served.

Screenshots

Create form

image image

Edit form

image

Show page

image

🤖 Generated with Claude Code

ShanaLMoore and others added 2 commits July 20, 2026 07:50
Points hyrax-webapp at samvera/hyku d431073 (merge of #3148,
'multi-select-typeahead-fields'), which pulls in the Hyrax compound
controlled-field work from samvera/hyrax#7540. This is the prerequisite
for the m3-profile `form: { multiple: true, autocomplete: true }`
opt-ins in the following commit to render.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds `form:` opt-ins to compound controlled sub-properties in the m3
profile, now honored by Hyrax's compound_controlled_select (via #7540):

- contributor_role: multiple + autocomplete — a contributor holds several
  typed roles in ONE compound row, searchable via select2 typeahead over
  the ~390-term contributor_roles authority (#92).
- license (~1450 SPDX terms), rights_statement, relationship_type:
  autocomplete — select2 typeahead for large controlled vocabularies (#93).
- date_type (11 inline values) intentionally left a plain dropdown.

Because role is now multi-value, it reads back as an array per compound
row (superseding the old one-compound-row-per-role storage). Enact::
WorkContributors and Enact::ContributorGraph now Array()-flatten each
entry's roles, backward-compatible with legacy single-string entries;
Enact::PeopleGraph already wrapped with Array(). Specs cover the new
array shape in both services.

Refs #92, #93. Requires the Hyrax bump in the previous commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ShanaLMoore
ShanaLMoore force-pushed the i92-role-multiselect-typeahead branch from aff1597 to 8644292 Compare July 20, 2026 15:07
@ShanaLMoore
ShanaLMoore requested review from Copilot and laritakr July 20, 2026 15:21
@github-actions

Copy link
Copy Markdown

Test Results

     4 files  ±0       4 suites  ±0   1m 1s ⏱️ -2s
89 510 tests +2  89 510 ✅ +2  0 💤 ±0  0 ❌ ±0 
   599 runs  +2     599 ✅ +2  0 💤 ±0  0 ❌ ±0 

Results for commit 8644292. ± Comparison against base commit 76cac72.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the deposit/edit metadata profile and contributor-related services to support (1) multi-select + typeahead contributor roles and (2) typeahead for controlled fields with larger vocabularies, while keeping service-layer readers backward-compatible with legacy single-role storage.

Changes:

  • Enable multi-select + autocomplete for contributor_role and autocomplete for large controlled vocabularies (license, rights_statement, relationship_type) in m3_profile.yaml.
  • Update Enact::WorkContributors and Enact::ContributorGraph to flatten roles when stored as either a legacy string or a new multi-select array.
  • Add specs to cover multi-role arrays in both services.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
config/metadata_profiles/m3_profile.yaml Opts controlled fields into autocomplete and enables multi-select for contributor roles.
app/services/enact/work_contributors.rb Flattens per-entry roles (string or array) when grouping credits per contributor.
app/services/enact/contributor_graph.rb Flattens per-entry roles (string or array) when building credited-work entries.
spec/services/enact/work_contributors_spec.rb Adds coverage for role arrays stored on a single compound entry.
spec/services/enact/contributor_graph_spec.rb Adds coverage for role arrays stored on a single compound entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@laritakr laritakr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work... this looks awesome

@ShanaLMoore
ShanaLMoore merged commit c0fdb30 into main Jul 20, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure usability for metadata fields with large lists of items (typeahead drop downs) Enable contributors to be given multiple roles for a given work

3 participants