Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespaces for the Vocabulary code #2118

Closed
pgwillia opened this issue Jan 26, 2021 · 3 comments
Closed

Namespaces for the Vocabulary code #2118

pgwillia opened this issue Jan 26, 2021 · 3 comments
Assignees

Comments

@pgwillia
Copy link
Member

Just as a general note, let's add a ticket to the backlog to introduce the concept of "namespaces" to the vocabulary code and these validators, to clean up the prefix everywhere.

Originally posted by @mbarnett in #2089 (comment)

Before
validates :rights, presence: true, uri: { in_vocabulary: :digitization_rights }

After
validates :rights, presence: true, uri: { namespace: :digitization, in_vocabulary: :rights }

Before
CONTROLLED_VOCABULARIES[:digitization_resource_type].txt

After
Digitization::CONTROLLED_VOCABULARIES[:resource_type].txt

@mbarnett
Copy link
Contributor

Just to note, API wise it will probably be easier to refactor towards & implement something like CONTROLLED_VOCABULARIES.digitization[:resource_type].txt or CONTROLLED_VOCABULARIES[:digitization][:resource_type].txt

@pgwillia pgwillia self-assigned this Jan 26, 2021
pgwillia added a commit that referenced this issue Feb 25, 2021
…ries

## Context

We're going to be adding digitization which will have it's own controlled vocabulary.  First we move everything ERA to it's own namespace.

Related to #2118

## What's New
1.  Changed API

From `translate_uri(vocab, uri)`

To `translate_uri(namespace, vocab, uri)`

And

From `humanize_uri(vocab, uri)`

To `humanize_uri(namespace, vocab, uri)`

And

From `validates :languages, presence: true, uri: { in_vocabulary: :language }` or   `validates :license, uri: { namespace: :era, in_vocabularies: [:license, :old_license] }`

To `validates :languages, presence: true, uri: { namespace: :era, in_vocabulary: :language }` or   `validates :license, uri: { namespace: :era, in_vocabularies: [:license, :old_license] }`

2. Added `:era` namespace
* config/controlled_vocabularies
* config/locales/en.yml#controlled_vocabularies
@mbarnett
Copy link
Contributor

This is now done with that PR I believe?

@pgwillia
Copy link
Member Author

Yes!

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

No branches or pull requests

2 participants