marinaglancy / moodle-format_flexsections

25 stars 25 forks source link

Moodle 4 stable: Courseindex does not go back to main course menu when returning from folded section #39

Closed VOOM108 closed 1 year ago

VOOM108 commented 1 year ago

(I open another issue because an earlier one with the same issue has a potentially misleading subject: https://github.com/marinaglancy/moodle-format_flexsections/issues/33)

This is using the current 4 STABLE - branch:

The courseindex does not behave like the topics format courseindex. Partly, this may be intentional, though I find it inconsistent. What I am referring to, is that there are carets for folding and unfolding a section, but they don't have any effect. The carets change direction, but the activities of that section are not shown in the menu. This applies to folded as well as open sections. (I am not sure about the EN wording of "folded/unfolded" but I guess you get, what I am referring to.)

A real bug is: Often, though not always, it keeps the contents of a subsection when returning to the course overview. Even when going to another course and returning, the index will still show the section content. Reloading the page does not change it either.

It would be ideal, in my opinion, if the courseindex would not change not much at all in comparison to the topics format.

VOOM108 commented 1 year ago

Actually this also happens the other way around: when entering a folded section, the main menu remains and the section's menu does not appear.

It seems it is an issue of refreshing the menu when switching between a section shown on it's own page and the course overview.

marinaglancy commented 1 year ago

Hi @VOOM108 , thanks for the report. Course index in flexsections format should work only for students (with the editing mode off). It does not refresh when you actively making changes to the course contents as a teacher. Unfortunately the way the course index is implemented in Moodle LMS it is impossible to change its behavior. As an option I can completely hide course index if the editing mode is on.

I can not reproduce what you are descriging, would you be able to record a screencast? Just remember to turn the editing mode off before reproducing.

VOOM108 commented 1 year ago

It definitely happens the same way, when editing mode is off. I have now switched the role to student, and it remains the same.

I recorded a screencast being logged in with an account where I am student only:

(had to delete and will upload anew in a few moments)

VOOM108 commented 1 year ago

So here it is, had to cover and remove customer's name...

https://user-images.githubusercontent.com/16562946/200136725-a5c0588e-b2c7-474a-ace6-bd4c16fd89a2.mov

marinaglancy commented 1 year ago

hi @VOOM108 thanks for the video. so I think we are talking about two problems here:

  1. the caret next to the collapsed sections in the course index does nothing. What do you think should happen when you click on it?

    • Should we lock it so it can not change between collapsed or expanded?
    • should we go to the section page when it is clicked?
    • should we always display contents of each section on the course index page? This is actually what "Topics" format does (When display mode is one section per page). This way the course index will be the same regardless if the user is on the course main page or in one of the sections.
  2. When you click on the "KURS" link the content on the page changes but the course index does not change. This is still a bit of a mystery to me. I can't reproduce it in Boost. What is this "KURS" link, is it something that your theme adds? How can I reproduce it myself, is this theme available in the plugins directory?

VOOM108 commented 1 year ago

I like the way it is in the topics format, being able to collapse and expand each section's content on the courseindex in the course overview, when clicking the carets. (Their changing state when clicking also makes you expect that.)

Though: what happens, if there are more than two levels of sections nested?

Also, I think it makes sense, that the menu reduces to the section's content, when only the section is shown, but goes back to the full overview when returning. But in my eyes that is not crucial.

The issue is the same if I switch to Boost, I already checked that. So I suppose the theme is not the issue. What you see, is the Moove 4 - Theme. It is available in the plugins directory.

"KURS" is German for "Course" - this is simply the link back to the course overview. The menu in the blue horizontal nav is the secondary nav, I cut off the primary horizontal nav in the video because of the logo.

As said - it may even happen the other way around - that the main index remains when switching to a collapsed section. Also, once the state is "stuck", it remains there even when leaving the course and coming back to it. I think, when logging out and back in, it starts where it should. The issue appears rather randomly, but about 50% of the clicks, and when it is stuck, it remains stuck.

marinaglancy commented 1 year ago

I have actually just reproduced it in Boost too. I had the development mode on with some caches disabled, when I enabled the caches I hit the problem. Thanks for taking the time to explain it. This course index is giving me headaches :( Maybe if we just have the same course index on all pages it will solve all these issues?

marinaglancy commented 1 year ago

... If there are more than two levels of nesting they will just be displayed indented. I mean, it does not matter, if we show course index for the collapsed sections separately or not - teacher can find a way to mess up layout anyway :)

BTW there is a PR waiting that introduces a limit to the depth of nesting - https://github.com/marinaglancy/moodle-format_flexsections/pull/28 - maybe it will prevent teachers from nesting too much

VOOM108 commented 1 year ago

That sounds good.... :) It would be like the topics format menu? With foldable sections? (Because of the sections being only links with functionless carets at the moment)...

marinaglancy commented 1 year ago

@VOOM108 , would you be able to test the new version? It will be in the courseindex branch of this repo for now

VOOM108 commented 1 year ago

Will I be able to downgrade to the current stable version easily, if necessary? I need to present the site tomorrow and don't want to risk having to redo what I have done so far...

marinaglancy commented 1 year ago

Yes, I didn't include version bump so you can switch back and forth. Just remember to purge caches after switching.

On Sun, 6 Nov 2022, 6:18 pm VOOM108, @.***> wrote:

Will I be able to downgrade to the current stable version easily, if necessary? I need to present the site tomorrow and don't want to risk having to redo what I have done so far...

— Reply to this email directly, view it on GitHub https://github.com/marinaglancy/moodle-format_flexsections/issues/39#issuecomment-1304849741, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGMK6SXRYPXSZUXJK4MYHLWG7R5NANCNFSM6AAAAAARXILYLU . You are receiving this because you commented.Message ID: @.***>

VOOM108 commented 1 year ago

For me, this works perfectly! The courseindex now let's me view the whole course content, not matter where I am at. Moving activities between folded sections used to be a hassle in the 3.X versions, here I can use the new option in the courseindex when editing. The subsections in the drawer also work nicely, being foldable.

Off topic: I use jQuery to replace icons with the help of shortcodes in the activity name. This makes sense for text pages showing an embedded video, and especially H5P-activities to visualize which H5P module is used. Of course I also need to remove the shortcode from the activity name - everywhere, where it may be shown. This works well except for the courseindex. I suspect, that the drawer may be populated after the script (located in the footer) already is executed.

Maybe, understanding more of how this is built: do you have an idea what my be the cause? (I also posted this on the Moodle forums)

marinaglancy commented 1 year ago

it is populated asynchronously after the page load. I can't find any events to listen to so you can add it to your JS but I can try to ask around. Where is the forum post that you created so we can discuss it there?

VOOM108 commented 1 year ago

https://moodle.org/mod/forum/discuss.php?d=440252

Could there be a way to make my script wait until menu is populated? Or is that, what you mean with "no event to listen to"?

Beansworthy commented 1 year ago

Just to clarify, the issues i have been seeing which are in this thread are:

  1. The Left nav bar doesnt show the activities of folded sections until navigation within them
  2. When navigating away from a folded section, the left nav bar does not update

Im Running the latest version of the plugin and the issues persist. Have these issues been fixed?

marinaglancy commented 1 year ago

This is available in the version 4.0.2 in both github and the plugins directory. Thanks everybody for help!