Skip to content

Commit

Permalink
Add customized menu for the admin course.
Browse files Browse the repository at this point in the history
  Move the links (nav menu) from the top of the admin page over to
  the main menu.  Also remove most of the course links since they
  don't really do much on the admin page.  Label this new menu
  'Admin Menu'.
  • Loading branch information
somiaj committed May 31, 2023
1 parent 882a6c5 commit 1665841
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 37 deletions.
48 changes: 48 additions & 0 deletions templates/ContentGenerator/Base/admin_links.html.ep
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<h2 class="navbar-brand mb-0"><%= maketext('Admin Menu') %></h2>
<ul class="nav flex-column">
<li class="list-group-item list-group-item-primary nav-item">
<%= link_to maketext('Courses') => 'root', class => 'nav-link' %>
</li>
<li class="list-group-item list-group-item-primary nav-item">
<%= $makelink->(
'set_list',
text => maketext('Course Administration'),
active => !param('subDisplay') && $c->url_for =~ /admin$/ ? 1 : 0
) %>
</li>
% for (
% [
% 'add_course',
% maketext('Add Course'),
% {
% add_admin_users => 1,
% add_config_file => 1,
% add_dbLayout => 'sql_single',
% add_templates_course => $ce->{siteDefaults}{default_templates_course} || ''
% }
% ],
% [ 'rename_course', maketext('Rename Course') ],
% [ 'delete_course', maketext('Delete Course') ],
% [ 'archive_course', maketext('Archive Course') ],
% [ 'unarchive_course', maketext('Unarchive Course') ],
% [ 'upgrade_course', maketext('Upgrade Courses') ],
% [ 'manage_locations', maketext('Manage Locations') ],
% [ 'hide_inactive_course', maketext('Hide Courses') ],
% )
% {
<li class="list-group-item list-group-item-primary nav-item">
<%= $makelink->(
'set_list',
text => $_->[1],
systemlink_params => { subDisplay => $_->[0], %{ $_->[2] // {} } },
active => (param('subDisplay') // '') eq $_->[0],
) %>
</li>
% }
<li class="list-group-item list-group-item-primary nav-item"><%= $makelink->('options') %></li>
<li class="list-group-item list-group-item-primary nav-item"><%= $makelink->('instructor_user_list') %></li>
<li class="list-group-item list-group-item-primary nav-item"><%= $makelink->('instructor_mail_merge') %></li>
<li class="list-group-item list-group-item-primary nav-item">
<%= link_to maketext('Report bugs') => $ce->{webworkURLs}{bugReporter}, class => 'nav-link' =%>
</li>
</ul>
11 changes: 5 additions & 6 deletions templates/ContentGenerator/Base/links.html.ep
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
% use WeBWorK::Utils qw(jitar_id_to_seq);
%
% if ($ce->{courseName} eq 'admin') {
<%= include 'ContentGenerator/Base/admin_links' =%>
% next;
% }
<h2 class="navbar-brand mb-0"><%= maketext('Main Menu') %></h2>
<ul class="nav flex-column">
% unless ($restricted_navigation) {
Expand All @@ -13,12 +17,7 @@
% if ($restricted_navigation) {
<span class="nav-link disabled"><%= maketext('Homework Sets') %></span>
% } else {
<%= $makelink->(
'set_list',
text => $ce->{courseName} eq 'admin'
? maketext('Course Administration')
: maketext('Homework Sets'),
) %>
<%= $makelink->('set_list', text => maketext('Homework Sets')) %>
% }
</li>
%
Expand Down
31 changes: 0 additions & 31 deletions templates/ContentGenerator/CourseAdmin.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,6 @@
% last;
% }
%
<ul class="nav nav-pills justify-content-center my-2">
% for (
% [
% 'add_course',
% maketext('Add Course'),
% {
% add_admin_users => 1,
% add_config_file => 1,
% add_dbLayout => 'sql_single',
% add_templates_course => $ce->{siteDefaults}{default_templates_course} || ''
% }
% ],
% [ 'rename_course', maketext('Rename Course') ],
% [ 'delete_course', maketext('Delete Course') ],
% [ 'archive_course', maketext('Archive Course') ],
% [ 'unarchive_course', maketext('Unarchive Course') ],
% [ 'upgrade_course', maketext('Upgrade Courses') ],
% [ 'manage_locations', maketext('Manage Locations') ],
% [ 'hide_inactive_course', maketext('Hide Courses') ],
% )
% {
<li class="nav-item">
<%= link_to $_->[1] =>
$c->systemLink(url_for, params => { subDisplay => $_->[0], %{ $_->[2] // {} } }),
class => 'nav-link' . ((param('subDisplay') // '') eq $_->[0] ? ' active' : '') =%>
</li>
% }
</ul>
%
<hr class="mt-0">
%
<%= include 'ContentGenerator/CourseAdmin/registration_form' %>
%
% if (@{ $c->{errors} }) {
Expand Down

0 comments on commit 1665841

Please sign in to comment.