Skip to content

Commit de5edce

Browse files
authored
Merge pull request #2925 from somiaj/description-info-icon
ProblemSets: Place set description in info button.
2 parents 4d198b5 + c32fda0 commit de5edce

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

htdocs/js/System/system.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474
// FIXME: These are really general purpose tooltips and not just in the homework sets editor. So the class name
7575
// should be chosen to better reflect this.
7676
document.querySelectorAll('.set-id-tooltip').forEach((el) => {
77-
if (el.dataset.bsTitle) new bootstrap.Tooltip(el, { fallbackPlacements: [] });
77+
if (el.dataset.bsTitle)
78+
new bootstrap.Tooltip(el, { fallbackPlacements: el.dataset.fallbackPlacements?.split(' ') || [] });
7879
});
7980

8081
// Hardcopy tooltips shown on the Problem Sets page.

templates/ContentGenerator/ProblemSets/set_list_row.html.ep

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@
1717
<div class="ms-3 me-auto">
1818
<div dir="ltr">
1919
<%= link_to $display_name => $c->systemLink(url_for('problem_list', setID => $set->set_id)),
20-
class => 'fw-bold set-id-tooltip',
21-
data => { bs_toggle => 'tooltip', bs_placement => 'right', bs_title => $set->description }
20+
class => 'fw-bold'
2221
=%>
22+
% if ($set->description =~ /\S/) {
23+
<a class="set-id-tooltip" role="button" tabindex="0" data-bs-placement="right"
24+
data-bs-toggle="tooltip" data-bs-title="<%= $set->description =%>"
25+
data-fallback-placements="top bottom">
26+
<i class="icon fas fa-circle-info" aria-hidden="true"></i>
27+
<span class="visually-hidden"><%= maketext('Assignment Description') =%></span>
28+
</a>
29+
% }
2330
</div>
2431
<div class="font-sm"><%= $status_msg %></div>
2532
% if (!$set->visible && $authz->hasPermissions(param('user'), 'view_unopened_sets')) {

0 commit comments

Comments
 (0)