Skip to content

Commit

Permalink
Merge pull request #2261 from drgrice1/no-nested-maketext
Browse files Browse the repository at this point in the history
Remove nested maketext calls.
  • Loading branch information
pstaabp authored Nov 20, 2023
2 parents 730c704 + 2dd0b68 commit f5e234a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 34 deletions.
16 changes: 7 additions & 9 deletions lib/WeBWorK/ContentGenerator/Options.pm
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,22 @@ sub initialize ($c) {
}
}
} else {
my $newPasswordText = $c->maketext("[_1]'s New Password", $e_user_name);
my $confirmNewPasswordText = $c->maketext("Confirm [_1]'s New Password", $e_user_name);
$c->addbadmessage($c->maketext(
"The passwords you entered in the [_1] and [_2] fields don't match. "
. 'Please retype your new password and try again.',
$c->tag('b', $c->maketext("[_1]'s New Password", $e_user_name)),
$c->tag('b', $c->maketext("Confirm [_1]'s New Password", $e_user_name))
$c->tag('b', $newPasswordText),
$c->tag('b', $confirmNewPasswordText)
));
}
} else {
my $fieldText =
$c->maketext("[_1]'s Current Password", $c->{user}->first_name . ' ' . $c->{user}->last_name);
$c->addbadmessage($c->maketext(
'The password you entered in the [_1] field does not match your current password. '
. 'Please retype your current password and try again.',
$c->tag(
'b',
$c->maketext(
"[_1]'s Current Password",
$c->{user}->first_name . ' ' . $c->{user}->last_name
)
)
$c->tag('b', $fieldText)
));
}
}
Expand Down
6 changes: 3 additions & 3 deletions templates/ContentGenerator/GatewayQuiz.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@
% {
<div class="gwMessage">
<strong>
<%== maketext('Note: [_1]',
tag('i', maketext('You are in the Reduced Scoring Period. All work counts for [_1]% of the original.',
$ce->{pg}{ansEvalDefaults}{reducedScoringValue} * 100))) =%>
% my $text = maketext('You are in the Reduced Scoring Period. All work counts for [_1]% of the original.',
% $ce->{pg}{ansEvalDefaults}{reducedScoringValue} * 100);
<%== maketext('Note: [_1]', tag('i', $text)) =%>
</strong>
</div>
% }
Expand Down
10 changes: 4 additions & 6 deletions templates/ContentGenerator/Instructor/ProblemSetDetail.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,10 @@
) =%>
</div>
<div class="col-md-6 mt-md-0 mt-2">
<%== maketext(
'Edit [_1] for set [_2].',
link_to(maketext('individual user settings') =>
$c->systemLink(url_for 'instructor_users_assigned_to_set')),
tag('span', dir => 'ltr', format_set_name_display($setID))
) =%>
% my $link = link_to(maketext('individual user settings') =>
% $c->systemLink(url_for 'instructor_users_assigned_to_set'));
<%== maketext('Edit [_1] for set [_2].',
$link, tag('span', dir => 'ltr', format_set_name_display($setID))) =%>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@
%
<div class="InfoPanel">
<div class="mb-2">
<%= label_for library_sets =>
maketext('[_1] Problems:', $lib eq '' ? maketext('Course Files') : $c->{problibs}{$lib}),
% my $courseFilesText = maketext('Course Files');
<%= label_for library_sets => maketext('[_1] Problems:', $lib eq '' ? $courseFilesText : $c->{problibs}{$lib}),
class => 'col-form-label-sm' =%>
<%= select_field library_sets => [
@$prob_dirs == 0 ? [ maketext('Found no directories containing problems') => '' ]
: (
$selected_library eq '' ? [ maketext('Select a Folder') => '', selected => undef, disabled => 'disabled' ] : (),
$selected_library eq ''
? [ maketext('Select a Folder') => '', selected => undef, disabled => 'disabled' ]
: (),
$lib ? (
map { [ $_ =~ s/^$lib\/(.*)$/$1/r => $_, $_ eq $selected_library ? (selected => undef) : () ] }
@$prob_dirs
) : (
map { [ $_ =~ s/^My Problems$/[templates folder]/r => $_, $_ eq $selected_library ? (selected => undef) : () ] }
map { [
$_ =~ s/^My Problems$/[templates folder]/r => $_,
$_ eq $selected_library ? (selected => undef) : ()
] }
@$prob_dirs
)
)
Expand Down
16 changes: 6 additions & 10 deletions templates/ContentGenerator/Instructor/UserDetail.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,12 @@
% # Display a message about how many sets have been assigned to this user.
<div class="text-center my-3">
<h2 class="fs-6">
<%== maketext(
'Edit [_1] for [_2] ([_3]) who has been assigned [_4] sets.',
link_to(maketext('class list data') => $c->systemLink(
url_for('instructor_user_list'),
params => { visible_users => $userID, editMode => 1 }
)),
$userName,
$userID,
scalar(keys %{ $c->{userSetRecords} })
) =%>
% my $link = link_to(maketext('class list data') => $c->systemLink(
% url_for('instructor_user_list'),
% params => { visible_users => $userID, editMode => 1 }
% ));
<%== maketext('Edit [_1] for [_2] ([_3]) who has been assigned [_4] sets.',
$link, $userName, $userID, scalar(keys %{ $c->{userSetRecords} })) =%>
</h2>
</div>
%
Expand Down
6 changes: 4 additions & 2 deletions templates/ContentGenerator/Login.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
%
% if ($ce->{session_management_via} ne 'session_cookie') {
<p>
% my $rememberMeText = maketext('Remember Me');
<%== maketext('If you check [_1] your login information will be remembered by the browser you are using, '
. 'allowing you to visit WeBWorK pages without typing your user name and password (until your session '
. 'expires). This feature is not safe for public workstations, untrusted machines, and machines '
. 'over which you do not have direct control.',
tag('strong', maketext('Remember Me'))
tag('strong', $rememberMeText)
) =%>
</p>
% }
Expand Down Expand Up @@ -68,8 +69,9 @@
% if (@$allowedGuestUsers) {
<div class="my-3">
<p>
% my $guestLoginText = maketext('Guest Login');
<%== maketext('This course supports guest logins. Click [_1] to log into this course as a guest.',
tag('b', maketext('Guest Login'))) =%>
tag('b', $guestLoginText)) =%>
</p>
<%= submit_button maketext('Guest Login'),
name => 'login_practice_user', class => 'btn btn-primary' =%>
Expand Down

0 comments on commit f5e234a

Please sign in to comment.