From bbfa50fe18e5410016ef6f9268cb4e7a6110a8e3 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Thu, 20 Jul 2023 17:59:21 -0500 Subject: [PATCH] Fix some minor issues. Use `format_set_name_display` for the set id in the title when editing set headers in the PGProblemEditor. Add a margin (class `mb-2`) to the bottom of the row containing the body in the system.html.ep template. If there are messages on these pages, the messages are currently flush up against the end content. This fixes that in a consistent way. The margins that were added on some pages to handle this issue have been removed. The problem with adding a margin to some element in the body aside from the inconsistency of handling this issue is that there can be content between the body and the bottom messages. Page warnings can appear there. The warnings margin has been adjusted to fit into this scheme. Ideally everything would add a margin to bottom, and only the to most element in the page (the page title) add a margin to the top. (Sounds like a niceTables.pl concept.) In a few cases this may add a bit too much space between the last body element and the messages (probably because there are missed instances where special handling for this was added before), but that is better than no margin. Fix some strings that were incorrectly interpolated for maketext in the view.html.ep template for the FileManager and in FileManager.pm itself. The first can be seen by selection a file that is neither a text or image file (like a tgz file), and clicking "View". This will show the message `The file $file does not appear to be a text or image file.` `$file` is literally what is shown in that message. The second can be seen by selecting some files in the file manager, and clicking "Make Archive". The message that comes back always tells you there were 0 files in the archive, even though the correct number of files were added to the archive. --- htdocs/themes/math4/system.html.ep | 4 ++-- lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm | 2 +- lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm | 5 +++-- .../ContentGenerator/Instructor/FileManager/view.html.ep | 2 +- .../ContentGenerator/Instructor/PGProblemEditor.html.ep | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/themes/math4/system.html.ep b/htdocs/themes/math4/system.html.ep index efb0d1a4dd..baf829f845 100644 --- a/htdocs/themes/math4/system.html.ep +++ b/htdocs/themes/math4/system.html.ep @@ -146,7 +146,7 @@ % } % % # Display the page body. -
+
<%= content =%>
@@ -160,7 +160,7 @@
% % if ($c->have_warnings) { -
<%= $c->warnings %>
+
<%= $c->warnings %>
% } % if ($c->can('message')) {
<%= $c->message %>
diff --git a/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm b/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm index df99b58948..5869750e92 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm @@ -358,7 +358,7 @@ sub MakeArchive ($c) { @files = readpipe $tar . ' 2>&1'; if ($? == 0) { my $n = scalar(@files); - $c->addgoodmessage($c->maketext('Archive "[_1]" created successfully ([quant, _2, file])', $archive, $n)); + $c->addgoodmessage($c->maketext('Archive "[_1]" created successfully ([quant,_2,file])', $archive, $n)); } else { $c->addbadmessage( $c->maketext(q{Can't create archive "[_1]": command returned [_2]}, $archive, systemError($?))); diff --git a/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm b/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm index 1145c34896..c82081e7e5 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm @@ -365,8 +365,9 @@ sub page_title ($c) { return $c->maketext('Editor') unless $c->{file_type}; - return $c->maketext('Set Header for set [_1]', $setID) if $c->{file_type} eq 'set_header'; - return $c->maketext('Hardcopy Header for set [_1]', $setID) if $c->{file_type} eq 'hardcopy_header'; + return $c->maketext('Set Header for set [_1]', format_set_name_display($setID)) if $c->{file_type} eq 'set_header'; + return $c->maketext('Hardcopy Header for set [_1]', format_set_name_display($setID)) + if $c->{file_type} eq 'hardcopy_header'; return $c->maketext('Hardcopy Theme') if $c->{file_type} eq 'hardcopy_theme'; return $c->maketext('Course Information for course [_1]', $c->stash('courseID')) if $c->{file_type} eq 'course_info'; diff --git a/templates/ContentGenerator/Instructor/FileManager/view.html.ep b/templates/ContentGenerator/Instructor/FileManager/view.html.ep index 6aba8c90f8..55e3c8014a 100644 --- a/templates/ContentGenerator/Instructor/FileManager/view.html.ep +++ b/templates/ContentGenerator/Instructor/FileManager/view.html.ep @@ -16,6 +16,6 @@ <%= image $fileManagerURL, style => 'border:0;', alt => $name =%> % } else {
- <%= maketext('The file $file does not appear to be a text or image file.') =%> + <%= maketext('The file "[_1]" does not appear to be a text or image file.', $file) =%>
% } diff --git a/templates/ContentGenerator/Instructor/PGProblemEditor.html.ep b/templates/ContentGenerator/Instructor/PGProblemEditor.html.ep index 069dc55553..56c6979649 100644 --- a/templates/ContentGenerator/Instructor/PGProblemEditor.html.ep +++ b/templates/ContentGenerator/Instructor/PGProblemEditor.html.ep @@ -209,6 +209,6 @@
<%= submit_button maketext($actionFormTitles->{$default_choice}), name => 'submit', id => 'take_action', - class => 'btn btn-primary mb-2' =%> + class => 'btn btn-primary' =%>
<% end =%>