moodle-an-hochschulen / moodle-local_boostnavigation

Moodle plugin which tries to overcome some fixed appearance behaviours of Boost's nav drawer in a clean way
GNU General Public License v3.0
39 stars 28 forks source link

Add option to position custom nodes #28

Closed jrm-unamur closed 5 years ago

jrm-unamur commented 5 years ago

Hi Alexander,

Following the discussion I analyzed your fantastic plugin a little more and found a way (I think) to address what I am missing, that is specify the position of the node in the nav drawer. That option doesn't require much change in the plugin, just an extra "case" in the switch dealing with custom nodes parsing and a few lines more. Are you interested? Cheers Jean-Roch

abias commented 5 years ago

Hi Jean-Roch,

thanks for creating this issue.

Yes, I think adding custom nodes at a defined position and not only at the end of one of the three node areas would make sense.

The add_node() function in navigationlib.php (see https://github.com/moodle/moodle/blob/master/lib/navigationlib.php#L374) has a second parameter $beforekey which the plugin doesn't use at the moment.

When I built the plugin initially, I already thought about it, but didn't add a configuration option for this setting because of two reasons:

  1. The parameter adds the node before a particular other node. I think most admins want to add a node after a particular other node, but for this there is no native support.
  2. To leverage this second parameter, you have to know the node key of the particular other node. This might get difficult as some node keys were autogenerated and not deterministic back then.

So, adding just one more setting to the already long list of settings (see https://github.com/moodleuulm/moodle-local_boostnavigation/blob/master/lang/en/local_boostnavigation.php#L128-L136) for the beforekey parameter would be fine. But you have to know that because of the two things above, you won't be able to cover all scenarios of adding a custom node at a particular position. And perhaps, the admin might be able to break things by building circular references or by placing the node outside of the particular node area. But in the end, this plugin is call "navigation fumbling", right?

So, summing up: Yes, this option would be appreciated. Please go ahead :)

Cheers, Alex

jrm-unamur commented 5 years ago

Hi Alex, Thanks for prompt answer. I agree with you as regards some limitations Another question: In the screenshots on the plugin page, there is a "break" over a custom block of nodes "Information for students". I couldn't find in the plugin code where this "divider" thing is handled Thanks in advance ps: how do you want me to share my code for the positioning thing? Cheers Jean-Roch

abias commented 5 years ago

Hi Jean-Roch,

ps: how do you want me to share my code for the positioning thing?

If would be best if you can create a pull request here in Github so that the code can be discussed and merged with standard Github tools.

Another question: In the screenshots on the plugin page, there is a "break" over a custom block of nodes "Information for students". I couldn't find in the plugin code where this "divider" thing is handled Thanks in advance

Separate questions should go into separate issues ;) But this one should be quick: The plugin supports three different areas for custom nodes: Custom nodes within the course navigation, custom nodes within the root navigation and custom nodes at the bottom of the navigation. If you add nodes to the bottom nodes area like it was done with the "Information for students" node, these nodes will be shown with a gap above them. If this does not work for you, please create a separate issue to discuss the problem.

Cheers, Alex

abias commented 5 years ago

Following the discussion in #28 and having merged your code in https://github.com/moodleuulm/moodle-local_boostnavigation/commit/e304bdf3ea7f96df95e5a02968c6753dd1ed0823, I am closing this issue.

Cheers, Alex