Skip to content

Commit

Permalink
Add cancel button to create new test version warning.
Browse files Browse the repository at this point in the history
Instead of telling user to click "Back Button", provide a
"Cancel" button which returns them to the previous page.

This also includes language updates as suggested during the
PR review.
  • Loading branch information
somiaj committed Nov 24, 2024
1 parent a694743 commit 8c36441
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/WeBWorK/ContentGenerator/GatewayQuiz.pm
Original file line number Diff line number Diff line change
Expand Up @@ -600,20 +600,19 @@ async sub pre_header_initialize ($c) {
{

$c->{invalidSet} = $c->maketext(
'User [_1] is being acted as. If you continue, you will create a new version of '
. 'this set for that user, which will count against their allowed maximum '
. 'number of versions for the current time interval. IN GENERAL, THIS IS NOT '
. 'WHAT YOU WANT TO DO. Please be sure that you want to do this before clicking '
. 'the "Create New Test Version" button below. Alternately, PRESS THE "BACK" BUTTON '
. 'and continue.',
'You are acting as user [_1]. If you continue, you will create a new version of '
. 'this test for that user, which will count against their allowed maximum '
. 'number of versions for the current time interval. In general, this is not '
. 'what you want to do. Please be sure that you want to do this before clicking '
. 'the "Create New Test Version" button below. Alternately, click "Cancel".',
$effectiveUserID
);
$c->{invalidVersionCreation} = 1;

} elsif ($effectiveUserID ne $userID) {
$c->{invalidSet} = $c->maketext(
'User [_1] is being acted as. When acting as another user, '
. 'new versions of the test cannot be created.',
'You are acting as user [_1], and do not have the permission to create a new test version '
. 'when acting as another user.',
$effectiveUserID
);
$c->{invalidVersionCreation} = 2;
Expand Down
6 changes: 6 additions & 0 deletions templates/ContentGenerator/GatewayQuiz.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
),
class => 'btn btn-primary'
=%>
<%= link_to maketext('Cancel') => $c->systemLink(
url_for('problem_list', setID => $setID),
params => { effectiveUser => $effectiveUserID, user => $userID }
),
class => 'btn btn-primary'
=%>
</div>
% }
</div>
Expand Down

0 comments on commit 8c36441

Please sign in to comment.