Skip to content

Trainers bip scholar - #1373

Open
kennethrioja wants to merge 3 commits into
ElixirTeSS:masterfrom
kennethrioja:trainers-bip-scholar
Open

Trainers bip scholar#1373
kennethrioja wants to merge 3 commits into
ElixirTeSS:masterfrom
kennethrioja:trainers-bip-scholar

Conversation

@kennethrioja

@kennethrioja kennethrioja commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

  • Shows a researcher infographic from BIP!Scholar under the ORCID of trainers

Motivation and context

As part of EVERSE WP5 'Training and Recognition', I am creating a link between BIP!Scholar and EVERSE Training. To allow more recognition for trainers, I am embedding a researcher infographic, first seen in APICURON (in your curator profile) and then provided by the BIP!Scholar team through: https://github.com/athenarc/bip-plugin/tree/main.

I chose to translate the widget in Ruby to avoid XSS. The compact and empty_mode parameters are kept. Some icons may have changed due to FA icons version used in TeSS. The base implementation using the JS widget is still shown in the commit 69d22e4.

Screenshots

If ORCID found AND in BIP!Scholar:

Screenshot 2026-08-26 at 10 26 56

If ORCID found AND in BIP!Scholar + layout: 'compact' in app/views/trainers/show.html.erb:

image

If ORCID not found OR not registered in BIP!Scholar:

image

If no ORCID OR not registered + empty_mode: 'silent' in app/views/trainers/show.html.erb

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds a server-rendered BIP!Scholar “researcher infographic” to trainer profile pages (keyed by the trainer’s ORCID), including styling and controller/view tests, to improve trainer recognition within TeSS.

Changes:

  • Embed a new BIP!Scholar infographic partial in trainers#show when an ORCID is present.
  • Add a helper to fetch/cache BIP!Scholar score data via HTTPS and render it safely via ERB.
  • Add new SCSS styling, image asset, and controller/view tests for the embed behavior.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/controllers/trainers_controller_test.rb Adds tests asserting presence/absence of the embed and fallback behaviors.
app/views/trainers/show.html.erb Renders the new infographic partial under the trainer ORCID section.
app/views/common/_bip_scholar_infographics.html.erb New ERB-rendered widget: fallback message, stats badge link, compact mode support.
app/helpers/bip_scholar_helper.rb New helper for fetching/caching BIP!Scholar API responses and formatting.
app/assets/stylesheets/pages/bip-scholar.scss Adds widget-specific styling.
app/assets/stylesheets/application.scss Imports the new BIP!Scholar stylesheet.
app/assets/images/bip-minimal.svg Adds the BIP!Scholar logo used in the badge.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1 to +2
module BipScholarHelper
require 'net/http'
Comment thread app/helpers/bip_scholar_helper.rb Outdated
return nil if orcid.blank?

# Cache in Redis for 24 hours to prevent blocking TeSS web threads
Rails.cache.fetch("bip_scholar_score_#{orcid}", expires_in: 24.hours) do
empty_mode = local_assigns.fetch(:empty_mode, 'default') # empty_mode hides BIP!Scholar widget if no ORCID on BIP!Scholar is found
%>

<div class="bip-scholar-embed" data-orcid="<%= orcid %>">

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Even without the hidden, we do not see blank div on the UI (even though it is present and not hidden in the HTML).
When adding the hidden, it doesn't change anything on the UI and we can still see it in the HTML as well but ok this is a safe hidden parameter, fair enough.

Comment on lines +44 to +52
<div class="bip-scholar-stat <%= 'bip-scholar-stat--group-sep' if stat[:sep] %>" title="<%= stat[:label] %>">
<span class="bip-scholar-stat-value">
<i class="fa fa-<%= stat[:icon] %> bip-scholar-stat-icon"></i>
<%= stat[:value] %>
</span>
<% unless is_compact %>
<span class="bip-scholar-stat-label"><%= stat[:label] %></span>
<% end %>
</div>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok to add class="sr-only" for accessibility as found in https://stackoverflow.com/a/19758620

Comment on lines +90 to +101
test 'should show bip-scholar embed in compact layout' do
BipScholarHelper.stub :fetch_score, nil do
# Simulates passing empty_mode: 'silent' in view partial render
html = @controller.render_to_string(
partial: 'common/bip_scholar_infographics',
locals: { orcid: @trainer.orcid, layout: 'compact', empty_mode: 'default' }
)
doc = Nokogiri::HTML(html)

assert_equal 0, doc.css('a.bip-scholar-badge.bip-scholar-badge--compact').size
end
end
<% if data.nil? %>
<% unless empty_mode == 'silent' %>
<div class="bip-scholar-no-profile">
<i class="fa fa-circle-info"></i>
@kennethrioja

Copy link
Copy Markdown
Contributor Author

I have addressed copilot reviews
And I have added more screenshots in the PR description to show the different UIs of the widgets depending on (ORCID found/not found AND/OR registered in BIP!Scholar) OR when layout: 'compact' OR when empty_mode: 'silent'

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