Skip to content

Display competency level more consistently#1287

Open
fbacall wants to merge 1 commit intomasterfrom
display-competency-levels
Open

Display competency level more consistently#1287
fbacall wants to merge 1 commit intomasterfrom
display-competency-levels

Conversation

@fbacall
Copy link
Copy Markdown
Member

@fbacall fbacall commented Apr 21, 2026

Summary of changes

  • Displays competency level in: learning path topics index, learning path topic show page, material show page, workflow show page.
  • Use label "Competency level" consistently across the site (in form, metadata and filter title)

Motivation and context

#1248

Screenshots

image

Checklist

  • I have read and followed the CONTRIBUTING guide.
  • I confirm that I have the authority necessary to make this contribution on behalf of its copyright owner and agree to license it to the TeSS codebase under the BSD license.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_level as “Competency level” (models + facet title).
  • Displays competency level on learning path topic index/show cards and workflow cards.
  • Adds difficulty_level to 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_level currently returns the raw stored ID (e.g. beginner) and returns an empty string for any other value (including the valid dictionary key notspecified). This leads to user-visible blanks (e.g. label rendered with no value) and is inconsistent with DifficultyDictionary titles (and HasDifficultyLevel indexing, which uses the title). Consider mapping IDs via DifficultyDictionary (e.g. use the entry title) and explicitly handling notspecified (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) %>
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

Successfully merging this pull request may close these issues.

2 participants