From f3d3af84c0a82949a14acbfaa90a839bedc13410 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 31 Mar 2026 16:54:18 -0500 Subject: [PATCH] Fix some layout and validation issues. First, remove the `div` with the `mb-3` class that I added to the `Email Instructor` button in #2935. I added it so that warnings or debug messages are appropriately spaced after the button on the problem page. However, the `feedback_macro_email.html.ep` template is used in other places for which that margin causes issues (for example on the problem set page). Instead the `div` is added on the problem page, if the button is to be shown. Note that `problemFooter` div has been removed, since that isn't even doing anything. Also, the database access in the `output_past_answer_button` is skipped if the button is not to be shown. I just saw this while working on the area and realized that is bad. Finally, the `h4` for the header of the achievement rewards dialog is changed to an `h1`. The css `h4` class is used to give the header the same size and style. Note that structurally a "modal dialog represents its own separate document/context, so the .modal-title should ideally be an `

`." That is quoted from bootstraps [modal dialog documentation](https://getbootstrap.com/docs/5.3/components/modal/). --- lib/WeBWorK/ContentGenerator/Problem.pm | 12 ++++++------ .../Base/feedback_macro_email.html.ep | 6 ++---- templates/ContentGenerator/Problem.html.ep | 9 +++++---- .../ProblemSet/auxiliary_tools.html.ep | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/WeBWorK/ContentGenerator/Problem.pm b/lib/WeBWorK/ContentGenerator/Problem.pm index ac08c1ff0e..aaea692faf 100644 --- a/lib/WeBWorK/ContentGenerator/Problem.pm +++ b/lib/WeBWorK/ContentGenerator/Problem.pm @@ -1442,13 +1442,13 @@ sub output_custom_edit_message ($c) { # Output the "Show Past Answers" button sub output_past_answer_button ($c) { - my $problemID = $c->{problem}->problem_id; - my $setRecord = $c->db->getGlobalSet($c->{problem}->set_id); - if (defined $setRecord && $setRecord->assignment_type eq 'jitar') { - $problemID = join('.', jitar_id_to_seq($problemID)); - } - if ($c->authz->hasPermissions($c->param('user'), 'view_answers')) { + my $problemID = $c->{problem}->problem_id; + my $setRecord = $c->db->getGlobalSet($c->{problem}->set_id); + if (defined $setRecord && $setRecord->assignment_type eq 'jitar') { + $problemID = join('.', jitar_id_to_seq($problemID)); + } + my $hiddenFields = $c->hidden_authen_fields; $hiddenFields =~ s/\"hidden_/\"pastans-hidden_/g; return $c->form_for( diff --git a/templates/ContentGenerator/Base/feedback_macro_email.html.ep b/templates/ContentGenerator/Base/feedback_macro_email.html.ep index 3d5f6f2a62..2c9d5a8b7a 100644 --- a/templates/ContentGenerator/Base/feedback_macro_email.html.ep +++ b/templates/ContentGenerator/Base/feedback_macro_email.html.ep @@ -6,8 +6,6 @@ % next if $key eq 'pg_object'; # Not used in internal feedback mechanism <%= hidden_field $key => $value =%> % } -
- <%= submit_button maketext($ce->{feedback_button_name}) || maketext('Email instructor'), - name => 'feedbackForm', class => 'btn btn-primary' =%> -
+ <%= submit_button maketext($ce->{feedback_button_name}) || maketext('Email instructor'), + name => 'feedbackForm', class => 'btn btn-primary' =%> % end diff --git a/templates/ContentGenerator/Problem.html.ep b/templates/ContentGenerator/Problem.html.ep index d79cbb165d..1a56d2af51 100644 --- a/templates/ContentGenerator/Problem.html.ep +++ b/templates/ContentGenerator/Problem.html.ep @@ -114,10 +114,11 @@ <% end =%> -
- <%= $c->output_past_answer_button =%> - <%= $c->output_email_instructor =%> -
+<%= $c->output_past_answer_button =%> +% my $emailInstructorButton = $c->output_email_instructor; +% if ($emailInstructorButton) { +
<%= $emailInstructorButton =%>
+% } <%= include 'ContentGenerator/Base/problem_warning_and_debug_output', warnings => $c->{pg}{warnings}, warning_messages => ref $c->{pg}{warning_messages} eq 'ARRAY' ? $c->{pg}{warning_messages} : [], diff --git a/templates/ContentGenerator/ProblemSet/auxiliary_tools.html.ep b/templates/ContentGenerator/ProblemSet/auxiliary_tools.html.ep index 34a70e4385..a6f765592b 100644 --- a/templates/ContentGenerator/ProblemSet/auxiliary_tools.html.ep +++ b/templates/ContentGenerator/ProblemSet/auxiliary_tools.html.ep @@ -43,7 +43,7 @@