my courses drop-down

my courses drop-down

by Michael Grainger -
Number of replies: 6

Apologies if this has been posted before - I couldn't find an answer searching forum.

I really like drop down lists for 'my courses' and 'my dashboard' in the essential theme. Can this be achieved in the 'more' theme for Moodle 2.7 using the additional CSS? I know how to add links to the custom menu to go to the 'my courses' page but I would really like to show the list of courses for logged in user in the drop-down. Is this done with java script or is there another way?

Thanks

Average of ratings: -
In reply to Michael Grainger

Re: my courses drop-down

by Richard Oelmann -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Its done in a renderer which overrides the custom menu renderer itself. This would have to be done within the theme itself and not from a setting or any of the available 'additional html' sections (CSS provides styling and not content such as this, so definitely the additional custom css box would not be a possibility)

Take a look at the render_custom_menu in core_renderers.php in the Essential theme. You may also want to look at the Overriding a Renderer page here

In reply to Michael Grainger

Re: my courses drop-down

by Hartmut Scherer -

Hi Michael,

I found Graham Bowman's post about adding "My courses" to custom menu HERE. When I add his code, I can see the arrow down indicating a submenu, but it's not displayed. All other submenus in custom menu are not displayed either in Clean Moodle 2.7. Perhaps you are more successful. No debug message.

With kind regards,

Hartmut

In reply to Michael Grainger

Re: my courses drop-down

by Hartmut Scherer -

Hi Michael,

I found a post written by Brian Merritt about "Bootstrap custom menus - this may help you" and added the following lines in Custom CSS

/* Automatic drop down in Navbar Fix for Bootstrap */

.sidebar-nav {

 padding: 9px 0;

}

.dropdown-menu .sub-menu {

 left: 100%;

 position: absolute;

 top: 0;

 visibility: hidden;

 margin-top: -1px;

}

.dropdown-menu li:hover .sub-menu {

 visibility: visible;

}

.dropdown:hover .dropdown-menu {

 display: block;

}

.nav-tabs .dropdown-menu, .nav-pills .dropdown-menu, .navbar .dropdown-menu {

 margin-top: 0;

}

.navbar .sub-menu:before {

 border-bottom: 7px solid transparent;

 border-left: none;

 border-right: 7px solid rgba(0, 0, 0, 0.2);

 border-top: 7px solid transparent;

 left: -7px;

 top: 10px;

}

.navbar .sub-menu:after {

 border-top: 6px solid transparent;

 border-left: none;

 border-right: 6px solid #fff;

 border-bottom: 6px solid transparent;

 left: 10px;

 top: 11px;

 left: -6px;

}

The first level of the submenu looks okay.

submenu - first level

But if the submenu has more than one level, all levels are immediately visible when for example hovering over "Links and tools."

all levels of submenu visible

The next level should only be visible when hovering over the respective top level button. What is missing in CSS?

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: my courses drop-down

by Michael Grainger -

That's a bit beyond my skills level I'm afraid - as I seem to remember this was a problem that occurred in Essential during the early days but was later fixed. There might be details on Julian's git page?

In reply to Michael Grainger

Re: my courses drop-down

by Chris Kenniburg -
Picture of Plugin developers

Check out my posting here: https://moodle.org/mod/forum/discuss.php?d=261529

I am in the process of developing a clone of the More theme and adding in the My Courses/My Dashboard/Google Font Picker, etc into the theme.  Totally ripped from Essential - Thank you Moodleman!

I have a working download you can try out. Once I clean up the code and make things nice I might try to get it into the repository.

In reply to Chris Kenniburg

Re: my courses drop-down

by Michael Grainger -

That's great - obviously I'm not the only one out there with this thought. I love Essential and think that Julian did a great job but for the sake of future-proofing I think using More is a much better option - especially if we can keep the my courses menu. I rely on it so much for quick navigation between all of the courses on.

Thanks