make keywords available for controlled vocabulary#1291
Open
mikesndrs wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds optional controlled-vocabulary support for keywords so events and materials can use the same dictionary-backed dropdown pattern already used for other vocabularies.
Changes:
- Add a new
KeywordsDictionaryclass and defaultconfig/dictionaries/keywords.yml. - Enable
keywordsas a supportedcontrolled_vocabulary_varsfeature in config comments. - Switch event/material keyword fields to use
f.dropdownwhen the controlled-vocabulary feature is enabled, and update the shared dropdown button label logic.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
config/tess.example.yml |
Documents keywords as an allowed controlled-vocabulary feature flag. |
config/dictionaries/keywords.yml |
Adds the default keyword dictionary file. |
app/views/materials/_form.html.erb |
Uses dictionary-backed dropdown keywords for materials when enabled. |
app/views/events/_form.html.erb |
Uses dictionary-backed dropdown keywords for events when enabled. |
app/views/common/_dropdown.html.erb |
Changes default dropdown button text generation to use the field label. |
app/dictionaries/keywords_dictionary.rb |
Adds the dictionary wrapper used to load keyword options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+94
to
+95
| <%= f.dropdown :keywords, | ||
| options: KeywordsDictionary.instance.options_for_select, |
| <% if TeSS::Config.feature['controlled_vocabulary_vars'].include? 'keywords' %> | ||
| <%= f.dropdown :keywords, | ||
| options: KeywordsDictionary.instance.options_for_select, | ||
| label: t('activerecord.attributes.event.keywords'), |
Comment on lines
+41
to
+46
| <%= f.dropdown :keywords, | ||
| options: KeywordsDictionary.instance.options_for_select, | ||
| label: t('activerecord.attributes.event.keywords'), | ||
| errors: @material.errors[:keywords], | ||
| title: t('events.hints.keywords'), | ||
| visibility_toggle: TeSS::Config.feature['materials_disabled'] %> |
| <% if TeSS::Config.feature['controlled_vocabulary_vars'].include? 'keywords' %> | ||
| <%= f.dropdown :keywords, | ||
| options: KeywordsDictionary.instance.options_for_select, | ||
| label: t('activerecord.attributes.event.keywords'), |
| options: KeywordsDictionary.instance.options_for_select, | ||
| label: t('activerecord.attributes.event.keywords'), | ||
| errors: @material.errors[:keywords], | ||
| title: t('events.hints.keywords'), |
Comment on lines
+40
to
+48
| <% if TeSS::Config.feature['controlled_vocabulary_vars'].include? 'keywords' %> | ||
| <%= f.dropdown :keywords, | ||
| options: KeywordsDictionary.instance.options_for_select, | ||
| label: t('activerecord.attributes.event.keywords'), | ||
| errors: @material.errors[:keywords], | ||
| title: t('events.hints.keywords'), | ||
| visibility_toggle: TeSS::Config.feature['materials_disabled'] %> | ||
| <% else %> | ||
| <%= f.multi_input :keywords, title: t('materials.hints.keywords'), visibility_toggle: TeSS::Config.feature['materials_disabled'] %> |
Comment on lines
+1
to
+10
| # Dictionary of Keywords | ||
| class KeywordsDictionary < Dictionary | ||
|
|
||
| DEFAULT_FILE = 'keywords.yml' | ||
|
|
||
| private | ||
|
|
||
| def dictionary_filepath | ||
| get_file_path 'keywords', DEFAULT_FILE | ||
| end |
fbacall
requested changes
May 5, 2026
Member
fbacall
left a comment
There was a problem hiding this comment.
As mentioned on slack, maybe remove the keywords.yml dictionary since it just has placeholders
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Enable controlled vocabulary dropdown for keywords
Checklist