Skip to content

Commit

Permalink
Merge pull request #2009 from somiaj/admin-course-menu
Browse files Browse the repository at this point in the history
Add customized menu for the admin course.
  • Loading branch information
pstaabp authored Jun 1, 2023
2 parents 6bb2cfd + 85ff135 commit af599e9
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 38 deletions.
49 changes: 49 additions & 0 deletions templates/ContentGenerator/Base/admin_links.html.ep
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<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"><%= $makelink->('instructor_file_manager') %></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>
13 changes: 6 additions & 7 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 Expand Up @@ -287,7 +286,7 @@
% && $authz->hasPermissions($userID, 'report_bugs'))
% {
<li class="list-group-item list-group-item-primary nav-item">
%= link_to maketext('Report bugs') => $ce->{webworkURLs}{bugReporter}, class => 'nav-link'
<%= link_to maketext('Report bugs') => $ce->{webworkURLs}{bugReporter}, class => 'nav-link' =%>
</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 af599e9

Please sign in to comment.