Skip to content

Commit 5e4bc0e

Browse files
drgrice1Alex-Jordan
authored andcommitted
Make the footer width adjustable per page.
This sets a default `footerWidthClass` stash value to `col-12` in the ContentGenerator `go` method. Any module or template can modify that as needed to match its layout. This is done in `templates/ContentGenerator/Instructor/Index.html.ep`, `templates/ContentGenerator/Instructor/Stats/index.html.ep`, and `templates/ContentGenerator/Problem.html.ep`. Note that this can also be done directly in the perl code for any package that derives from the ContentGenerator as well (i.e., in a `.pm` file). To do so call `$c->stash->{footerWidthClass} = '...'`. I have left the remaining pages for you to determine, since I am uncertain what you will want on some of them.
1 parent 667927d commit 5e4bc0e

File tree

6 files changed

+22
-12
lines changed

6 files changed

+22
-12
lines changed

htdocs/themes/math4/system.html.ep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
% }
173173
%
174174
% # Footer
175-
<div id="footer" role="contentinfo" class="row"><%= include 'ContentGenerator/Base/footer' %></div>
175+
<%= include 'ContentGenerator/Base/footer' =%>
176176
</div>
177177
</div>
178178
%

lib/WeBWorK/ContentGenerator.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ async sub go ($c) {
122122

123123
my $tx = $c->render_later->tx;
124124

125+
$c->stash->{footerWidthClass} = 'col-12';
126+
125127
if ($c->can('pre_header_initialize')) {
126128
my $pre_header_initialize = $c->pre_header_initialize;
127129
await $pre_header_initialize
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
<div class="col-lg-10">
2-
<div id="last-modified"><%= maketext('Page generated [_1]', $c->timestamp) %></div>
3-
<div id="copyright">
4-
<%== maketext(
5-
'WeBWorK &copy; [_1] | theme: [_2] | ww_version: [_3] | pg_version [_4]',
6-
$ce->{WW_COPYRIGHT_YEARS} || '1996-2023',
7-
$ce->{defaultTheme} || 'unknown -- set defaultTheme in localOverides.conf',
8-
$ce->{WW_VERSION} || 'unknown -- set WW_VERSION in VERSION',
9-
$ce->{PG_VERSION} || 'unknown -- set PG_VERSION in ../pg/VERSION'
10-
) %>
1+
<div id="footer" role="contentinfo" class="row">
2+
<div class="<%= $footerWidthClass %>">
3+
<div id="last-modified"><%= maketext('Page generated [_1]', $c->timestamp) %></div>
4+
<div id="copyright">
5+
<%== maketext(
6+
'WeBWorK &copy; [_1] | theme: [_2] | ww_version: [_3] | pg_version [_4]',
7+
$ce->{WW_COPYRIGHT_YEARS} || '1996-2023',
8+
$ce->{defaultTheme} || 'unknown -- set defaultTheme in localOverides.conf',
9+
$ce->{WW_VERSION} || 'unknown -- set WW_VERSION in VERSION',
10+
$ce->{PG_VERSION} || 'unknown -- set PG_VERSION in ../pg/VERSION'
11+
) %>
12+
</div>
13+
<a href="https://openwebwork.org/"><%= maketext('The WeBWorK Project') %></a>
1114
</div>
12-
<a href="https://openwebwork.org/"><%= maketext('The WeBWorK Project') %></a>
1315
</div>

templates/ContentGenerator/Instructor/Index.html.ep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<%= maketext('Select user(s) and/or set(s), and click the action button of your choice below.') =%>
1717
</p>
1818
%
19+
% stash->{footerWidthClass} = 'col-xl-10';
20+
%
1921
<%= form_for current_route, method => 'POST', id => 'instructor-tools-form', begin =%>
2022
<%= $c->hidden_authen_fields =%>
2123
%

templates/ContentGenerator/Instructor/Stats/index.html.ep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
%
66
% my $type = current_route =~ s/instructor_//r;
77
%
8+
% stash->{footerWidthClass} = 'col-lg-10';
9+
%
810
<div class="row">
911
<div class="col-lg-5 col-sm-6 mb-2">
1012
<div class="card h-100">

templates/ContentGenerator/Problem.html.ep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
% last;
6868
% }
6969
%
70+
% stash->{footerWidthClass} = 'col-lg-10';
71+
%
7072
<%== $c->post_header_text =%>
7173
<div id="custom_edit_message" class="row"><div class="col-lg-10"><%= $c->output_custom_edit_message %></div></div>
7274
<div class="row"><div id="output_summary" class="col-lg-10"><%= $c->output_summary %></div></div>

0 commit comments

Comments
 (0)