Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses #1248 by making “Competency level” visible and consistently labeled across multiple resource pages (learning path topics, materials, workflows) and in facet/filter UI.
Changes:
- Adds/standardizes I18n labels for
difficulty_levelas “Competency level” (models + facet title). - Displays competency level on learning path topic index/show cards and workflow cards.
- Adds
difficulty_levelto the shared “extra metadata” sidebar output and updates form labels to rely on I18n.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| config/locales/en.yml | Adds “Competency level” translations for model attributes and facet title. |
| app/views/workflows/_workflow.html.erb | Shows difficulty/competency level on workflow cards. |
| app/views/materials/_material.html.erb | Updates helper call to display competency level from difficulty_level. |
| app/views/materials/_form.html.erb | Removes hardcoded label to use I18n-driven “Competency level”. |
| app/views/learning_paths/show.html.erb | Updates difficulty display helper call for topics within a learning path. |
| app/views/learning_path_topics/show.html.erb | Adds a sidebar section displaying competency level for a topic. |
| app/views/learning_path_topics/_learning_path_topic.html.erb | Shows competency level on learning path topic index cards. |
| app/views/learning_path_topics/_form.html.erb | Removes hardcoded label to use I18n-driven “Competency level”. |
| app/views/common/_extra_metadata.html.erb | Adds difficulty_level to shared metadata rendering. |
| app/helpers/materials_helper.rb | Changes display_difficulty_level signature to accept a value directly. |
Comments suppressed due to low confidence (1)
app/helpers/materials_helper.rb:62
display_difficulty_levelcurrently returns the raw stored ID (e.g.beginner) and returns an empty string for any other value (including the valid dictionary keynotspecified). This leads to user-visible blanks (e.g. label rendered with no value) and is inconsistent withDifficultyDictionarytitles (andHasDifficultyLevelindexing, which uses the title). Consider mapping IDs viaDifficultyDictionary(e.g. use the entrytitle) and explicitly handlingnotspecified(either render “Not specified” or treat it as absent).
def display_difficulty_level(value)
if value == 'beginner'
'• ' + value
elsif value == 'intermediate'
'•• ' + value
elsif value == 'advanced'
'••• ' + value
else
''
end
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+14
to
+15
| <% if workflow.difficulty_level.present? %> | ||
| <div class="font-size-lg"><%= display_difficulty_level(workflow.difficulty_level) %></div> |
| </div> | ||
|
|
||
| <div class="font-size-lg"><%= display_difficulty_level(material) %></div> | ||
| <div class="font-size-lg"><%= display_difficulty_level(material.difficulty_level) %></div> |
Comment on lines
+5
to
+6
| <% if learning_path_topic.difficulty_level.present? %> | ||
| <div class="font-size-lg"><%= display_difficulty_level(learning_path_topic.difficulty_level) %></div> |
Comment on lines
+24
to
+25
| <% if @learning_path_topic.difficulty_level.present? %> | ||
| <span class="label label-default"><%= display_difficulty_level(@learning_path_topic.difficulty_level) %></span> |
Comment on lines
69
to
71
| <% if lpt.topic.difficulty_level.present? %> | ||
| <span class="label label-default"><%= display_difficulty_level(lpt.topic) %></span> | ||
| <span class="label label-default"><%= display_difficulty_level(lpt.topic.difficulty_level) %></span> | ||
| <% end %> |
| <%= display_attribute(resource, :licence) { |value| licence_name_for_abbreviation(value) } if resource.respond_to?(:licence) %> | ||
| <%= display_attribute(resource, :contact) if resource.respond_to?(:contact) %> | ||
| <%= display_attribute(resource, :keywords) { |values| values.join(', ') } %> | ||
| <%= display_attribute(resource, :difficulty_level) { |value| display_difficulty_level(value) } if resource.respond_to?(:difficulty_level) %> |
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
Motivation and context
#1248
Screenshots
Checklist