-
Notifications
You must be signed in to change notification settings - Fork 19
make keywords available for controlled vocabulary #1291
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Dictionary of Keywords | ||
| class KeywordsDictionary < Dictionary | ||
|
|
||
| DEFAULT_FILE = 'keywords.yml' | ||
|
|
||
| def dictionary_filepath | ||
| get_file_path 'keywords', DEFAULT_FILE | ||
| end | ||
|
Comment on lines
+1
to
+8
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should not be a concern as deployments with controlled vocabulary should not have the other values anyway
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kinda agree with copilot. It is a bit weird to have this as a dictionary when really it just needs to be a list of values. If you wanted to have a controlled list of 50 keywords you would have to make up 50 random ids that are never actually used anywhere. It could easily just be a txt file with each keyword separated by a linebreak, or a YAML file with just a list of strings. But maybe that would require too many changes? |
||
|
|
||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,8 +3,6 @@ class TargetAudienceDictionary < Dictionary | |
|
|
||
| DEFAULT_FILE = 'target_audience.yml' | ||
|
|
||
| private | ||
|
|
||
|
Comment on lines
-6
to
-7
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep this private |
||
| def dictionary_filepath | ||
| get_file_path 'target_audience', DEFAULT_FILE | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,8 +90,16 @@ | |
| title: t('events.hints.hosts') %> | ||
|
|
||
| <!-- Field: Keywords --> | ||
| <%= f.multi_input :keywords, errors: @event.errors[:keywords], | ||
| title: t('events.hints.keywords') %> | ||
| <% if TeSS::Config.feature['controlled_vocabulary_vars'].include? 'keywords' && File.exist?(KeywordsDictionary.instance.dictionary_filepath) %> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't do this check here |
||
| <%= f.dropdown :keywords, | ||
| options: KeywordsDictionary.instance.options_for_select, | ||
|
mikesndrs marked this conversation as resolved.
|
||
| label: t('activerecord.attributes.event.keywords', default: 'Keywords'), | ||
| errors: @event.errors[:keywords], | ||
| title: t('events.hints.keywords') %> | ||
| <% else %> | ||
| <%= f.multi_input :keywords, errors: @event.errors[:keywords], | ||
| title: t('events.hints.keywords') %> | ||
| <% end %> | ||
|
|
||
| <!-- Field: Fields --> | ||
| <% if !TeSS::Config.feature['disabled'].include? 'ardc_fields_of_research' %> | ||
|
|
@@ -105,7 +113,7 @@ | |
| <% end %> | ||
|
|
||
| <!-- Field: Target Audience --> | ||
| <% if TeSS::Config.feature['controlled_vocabulary_vars'].include? 'target_audience' %> | ||
| <% if TeSS::Config.feature['controlled_vocabulary_vars'].include? 'target_audience' && File.exist?(TargetAudienceDictionary.instance.dictionary_filepath) %> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't do this check here |
||
| <%= f.dropdown :target_audience, | ||
| options: TargetAudienceDictionary.instance.options_for_select, | ||
| label: 'Target audiences', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would hide legit errors e.g. if you typo'd the dictionary name