Trainers bip scholar - #1373
Open
kennethrioja wants to merge 2 commits into
Open
Conversation
kennethrioja
force-pushed
the
trainers-bip-scholar
branch
from
August 26, 2026 09:39
4164297 to
def10b7
Compare
kennethrioja
force-pushed
the
trainers-bip-scholar
branch
from
August 26, 2026 09:39
def10b7 to
5dcabdb
Compare
Contributor
There was a problem hiding this comment.
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#showwhen 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' |
| 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 %>"> |
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> |
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> |
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
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
compactandempty_modeparameters 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
Checklist