/* Remove the left-side Course Index */
.drawer-toggles .drawer-left-toggle .btn {
display: none;
}
The CSS solution above doesn't seem to work for all Moodle pages. I tested it and it failed in at least one particular case. There seem to be a lot of CSS elements involved here and I spent a lot of time trying to find the right ones... That's why I finally opted to modify the code.
The solution proposed in the code is simple. Since the index only appears once connected, the solution aims to deactivate the index once connected (if I have understood well...).
Best regards
As suggested, I have tested to replace in theme/boost/config.php and theme/adaptable/config.php
$THEME->usescourseindex = true;
to
$THEME->usescourseindex = false;
but it didn't work.
As far as I can tell, what works is to replace in theme/adaptable/layout/includes/courseindexheader.php, line 33,
$courseindexopen = (get_user_preferences('drawer-open-index', true) == true);
by
$courseindexopen = (get_user_preferences('drawer-open-index', true) == false);
AND to add in the adaptable CSS (as suggested by Rick):
/* Remove the left-side Course Index */
.drawer-toggles .drawer-left-toggle .btn {
display: none;
}
Hopefully there will be a way in the future to enable/disable the course index in the adaptable parameters.
I am not opposed to code changes. As mentioned earlier, you must remember to make this change whenever upgrading.
One more alternative might be to create your own theme. I cannot help with that, but others here on Moodle.org might be able to help.
I have just noticed that some course formats, such as "Designer" and "Flexible sections", allow you to disable/enable the course index. This feature should thus be added to the core course formats... !
Consider creating a Tracker item for this idea. (I am not sure if a Tracker item already exists.)
Great. This might get the ball rolling. I voted for it.
I make this change with a script file I use when upgrading my Moodle. This "SED" command (SED exists on many Linux servers" is what I use. Sometimes this SED command will need to be slightly modified for a version of Linux (like MacOS).
I wanted to share this as a temporary fix.
# Do this replacement to remove the courseindex block
# $courseindexopen = (get_user_preferences('drawer-open-index', true) == true);
echo "Modify theme to not display the courseindex."
sed -i 's/true) == true/true) == false/' yourmoodlelocation/theme/boost/layout/drawers.php
Hi,
just wanted to leave this for people who use their own child theme and do not want to remove the course-index completly, but want to hide it (close) by default.
I just remove the following lines from the template you want to modify:
just remove or mark the lines check for the usersetting in the proper layout e.g. columns2.php in the layout folder
the drawer will than be as you decide (false or true) but still be adjustable by the user each time the side is loaded
/*
if (isloggedin()) {
$navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
} else {
$navdraweropen = false;
}*/
$navdraweropen = false;
not perfect, but easy to do and calms down those who are in need of it.
I discovered that my fix didn't quite remove the courseindex. Here is my code that seems to work. Again, I run this code from a script file.
echo "Modify Boost drawers.php file to not display the courseindex."
sed -i 's/(get_user_preferences('drawer-open-index', true) == true)/false/' $mdupcodedir$mdupcodename/theme/boost/layout/drawers.php
Sorry! 🤦♂️ Thank you for checking! We do this in different themes in different flavours (both drawers, custom navigation and our own elements) - It seems I mismatched some code pieces
/* Hide the left-side drawer completely */
.drawer.drawer-left {
display: none !important;
}
----
It still leaves the left side container, I am working to remove that now but this post only has a 30 minute edit window. I will reply if I remove the left container as well.
I have the same need - hiding the course index - for Boost Union. I am testing this CSS which seems to work:
/* Reduce left column course index to 40px - just enough to display the close "x" icon. In case for some reason it is open */
.drawer.drawer-left {
width: 40px;
max-width: 285px;
left: calc(-285px + -10px);
visibility: hidden;
}
/* Hide the left "open course index" button*/
.drawer-toggles .drawer-left-toggle {
left: 0;
display: none;
}
I am adding this custom CSS in a Boost Union "Flavor" so that I can apply it only to a specific category of courses.
John