Skip to content

Commit

Permalink
Merge pull request #351 from matematikk-mooc/KURSP-928-remove-items-f…
Browse files Browse the repository at this point in the history
…rom-course-page

KURSP-928: remove items from course page, that is not needed in student view
  • Loading branch information
ThereseRingPersen authored Nov 10, 2023
2 parents 371bbe6 + e200653 commit 2f3d595
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ jQuery(function($) {
util.removeRecentFeedback();
groups.interceptLinksToGroupPage();
coursepage.showCourseInvitation();
pages.removeItemsInStudentView();
// override default view and display all courses list instead
var courseView = util.isCourseFrontpageForAllCoursesList();
if (courseView == util.courseListEnum.allCoursesList) {
Expand Down Expand Up @@ -655,7 +656,7 @@ jQuery(function($) {
try {
menu.injectGroupsPage();
groups.changeGroupListURLs(document.location.href);

pages.removeItemsInStudentView();
pages.updateSidebarWhenMarkedAsDone();
pages.updateSidebarWhenContributedToDiscussion();
menu.alterCourseLink();
Expand Down
19 changes: 18 additions & 1 deletion src/js/modules/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,24 @@ export default (function() {
buttonHtml += '<i class="icon-student-view"></i>Studentvisning</a>';
addButton(buttonHtml);
},

removeItemsInStudentView: function() {
const userIsStudent = !util.isTeacherOrAdmin();
if (userIsStudent) {
// Get the element with the ID "sticky-container"
var adminNavigation = document.getElementById('sticky-container');
// Check if the element is found
if (adminNavigation) {
// Remove the element from the DOM
adminNavigation.parentNode.removeChild(adminNavigation);
}
var adminHeader = document.querySelector('.header-bar-outer-container');
// Check if the element is found
if (adminHeader) {
// Remove the element from the DOM
adminHeader.parentNode.removeChild(adminHeader);
}
}
},
updateSidebarWhenMarkedAsDone: function() {
$('body').on('click', '#mark-as-done-checkbox', function() {
var icon = $('ul.mmooc-module-items .active span:last-child');
Expand Down

0 comments on commit 2f3d595

Please sign in to comment.