diff --git a/lib/WeBWorK/ContentGenerator/ProblemSet.pm b/lib/WeBWorK/ContentGenerator/ProblemSet.pm index 5f025e357c..c77ce3ef77 100644 --- a/lib/WeBWorK/ContentGenerator/ProblemSet.pm +++ b/lib/WeBWorK/ContentGenerator/ProblemSet.pm @@ -48,7 +48,7 @@ async sub initialize ($c) { my $eUserID = $c->param('effectiveUser'); # Don't show "Start New Test" button when acting as another user, unless user has permissions to do so. - $c->{hide_start_new_test} = $userID ne $eUserID + $c->{disable_start_new_test} = $userID ne $eUserID && !($authz->hasPermissions($userID, 'record_answers_when_acting_as_student') || $authz->hasPermissions($userID, 'create_new_set_version_when_acting_as_student')); diff --git a/templates/ContentGenerator/ProblemSet/version_list.html.ep b/templates/ContentGenerator/ProblemSet/version_list.html.ep index 7c91f5ebf3..d9c179670d 100644 --- a/templates/ContentGenerator/ProblemSet/version_list.html.ep +++ b/templates/ContentGenerator/ProblemSet/version_list.html.ep @@ -126,13 +126,23 @@
<%= maketext('This test requires a proctor password to start.') %>
% } % - % # Hide "Start New Test" button when acting as another use who doesn't have permissions to start test. - % unless ($c->{hide_start_new_test}) { -
- <%= link_to maketext('Start New Test') => $c->systemLink(url_for($routeName, setID => $set->set_id)), - class => 'btn btn-primary' =%> -
+ % # Disable "Start New Test" button when acting as another use who doesn't have permissions to start test. + % my $disabled = ''; + % my $disabled_tooltip = ''; + % if ($c->{disable_start_new_test}) { + % $disabled = ' disabled'; + % $disabled_tooltip = ' class="d-inline-block" tabindex="0" data-bs-toggle="tooltip" ' + % . 'data-bs-placement="top" title="' + % . maketext( + % 'You are acting as another user and do not have permission to start a new test for other users.') + % . '"'; % } +
+ > + <%= link_to maketext('Start New Test') => $c->systemLink(url_for($routeName, setID => $set->set_id)), + class => "btn btn-primary$disabled" =%> + +
% } else { % # Message about if/when next version will be available. % my $msg = maketext('No more tests available.');