Conversation
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.
…dictionary. Show competency level description when hovered
There was a problem hiding this comment.
Pull request overview
This PR addresses #1248 by surfacing “Competency level” (difficulty level) more consistently across learning path topics, materials, workflows, and learning paths, and by standardizing the label text via i18n.
Changes:
- Add i18n translations so difficulty level displays as “Competency level” (including facet title).
- Render competency level badges/text in learning path topic cards/show sidebar, material cards, workflow cards, and learning path cards.
- Update
display_difficulty_levelhelper to accept a difficulty key and render a tooltip-enabled label.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| config/locales/en.yml | Adds “Competency level” translations for model attributes and facets. |
| app/views/workflows/_workflow.html.erb | Shows competency level on workflow cards. |
| app/views/materials/_material.html.erb | Shows competency level on material cards (conditionally). |
| app/views/materials/_form.html.erb | Removes hard-coded label so i18n label is used. |
| app/views/learning_paths/show.html.erb | Updates topic competency badge rendering to new helper signature. |
| app/views/learning_paths/_learning_path.html.erb | Shows competency level badge on learning path cards. |
| app/views/learning_paths/_form.html.erb | Adds difficulty level field to learning path form. |
| app/views/learning_path_topics/show.html.erb | Adds competency level section in sidebar + i18n headings. |
| app/views/learning_path_topics/_learning_path_topic.html.erb | Adds competency badge + materials count to topic tiles. |
| app/views/learning_path_topics/_form.html.erb | Removes hard-coded label so i18n label is used. |
| app/views/common/_extra_metadata.html.erb | Adds difficulty level to shared metadata rendering. |
| app/helpers/materials_helper.rb | Refactors helper to accept value key and return tooltip-enabled HTML. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <% if competency %> | ||
| <span class="label label-default"><%= competency %></span> | ||
| <% end %> | ||
| <span class="label label-default"><i class="fa fa-book"></i> <%= pluralize(learning_path_topic.materials.count, 'materials') %></span> |
| def display_difficulty_level(value) | ||
| data = DifficultyDictionary.instance.lookup(value) | ||
| return nil if data.nil? || value == 'notspecified' | ||
| if value == 'beginner' | ||
| '• ' + value | ||
| text = '• ' + data['title'] | ||
| elsif value == 'intermediate' | ||
| '•• ' + value | ||
| text = '•• ' + data['title'] | ||
| elsif value == 'advanced' | ||
| '••• ' + value | ||
| text = '••• ' + data['title'] | ||
| else | ||
| '' | ||
| text = data['title'] | ||
| end | ||
|
|
||
| content_tag(:span, text, title: data['description']) | ||
| end |
| material: | ||
| difficulty_level: Competency level | ||
| learning_path_topic: | ||
| difficulty_level: Competency level | ||
| workflow: | ||
| difficulty_level: Competency level |
| <%= 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) %> |
Summary of changes
Motivation and context
#1248
Screenshots
Checklist