Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-75903

Selection of active primary navigation node is not precise enough

    XMLWordPrintable

Details

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • Hide
      1. Copy hello.php to your wwwroot
      2. Apply patch 75903.diff to your site:

        diff --git a/lib/classes/navigation/views/primary.php b/lib/classes/navigation/views/primary.php
        index 8ab9124..75c2806 100644
        --- a/lib/classes/navigation/views/primary.php
        +++ b/lib/classes/navigation/views/primary.php
        @@ -70,6 +70,16 @@ class primary extends view {
                     if ($showcoursesnode) {
                         $this->add(get_string('mycourses'), new \moodle_url('/my/courses.php'), self::TYPE_ROOTNODE, null, 'mycourses');
                     }
        +
        +            for ($i = 1; $i <= 3; $i++) {
        +                $this->add(
        +                    "Page {$i}",
        +                    new \moodle_url('/hello.php', ['id' => $i]),
        +                    navigation_node::TYPE_ROOTNODE,
        +                    null,
        +                    "page-{$i}"
        +                );
        +            }
                 }
         
                 $showsiteadminnode = empty($this->page->theme->removedprimarynavitems) ||
        

      3. Log in as admin
      4. Press Page 1 in primary navigation
      5. Confirm only Page 1 is active
      6. Press Page 2 in primary navigation
      7. Confirm only Page 2 is active
      8. Press Page 3 in primary navigation
      9. Confirm only Page 3 is active
      10. Regression test:
        • Press on each of Home / Dashboard / My courses / Site administration in primary navigation
        • Confirm the item you clicked on is the active
      Show
      Copy hello.php to your wwwroot Apply patch 75903.diff to your site: diff --git a/lib/classes/navigation/views/primary.php b/lib/classes/navigation/views/primary.php index 8ab9124..75c2806 100644 --- a/lib/classes/navigation/views/primary.php +++ b/lib/classes/navigation/views/primary.php @@ -70,6 +70,16 @@ class primary extends view { if ($showcoursesnode) { $this->add(get_string('mycourses'), new \moodle_url('/my/courses.php'), self::TYPE_ROOTNODE, null, 'mycourses'); } + + for ($i = 1; $i <= 3; $i++) { + $this->add( + "Page {$i}", + new \moodle_url('/hello.php', ['id' => $i]), + navigation_node::TYPE_ROOTNODE, + null, + "page-{$i}" + ); + } } $showsiteadminnode = empty($this->page->theme->removedprimarynavitems) || Log in as admin Press Page 1 in primary navigation Confirm only Page 1 is active Press Page 2 in primary navigation Confirm only Page 2 is active Press Page 3 in primary navigation Confirm only Page 3 is active Regression test: Press on each of Home / Dashboard / My courses / Site administration in primary navigation Confirm the item you clicked on is the active

    Description

      The selection of the active node in primary navigation does not account for multiple nodes whose action URL differs only by the params

      1. Page 1 is clicked on/active
        • Page 1 is highlighted
      2. Page 2 is clicked on/active
        • Page 1 & Page 2 are highlighted
      3. Page 3 is clicked on/active
        • Page 1 & Page 3 are highlighted

      I'll come up with simple replication script, but this is a genuine problem in Workplace (WP-3549)

      Attachments

        1. 72903.gif
          140 kB
          Paul Holden
        2. 75903.diff
          0.8 kB
          Paul Holden
        3. hello.php
          0.3 kB
          Paul Holden
        4. MDL-75903_master.mp4
          878 kB
          John Edward Pedregosa
        5. MDL-75903_v400.mp4
          945 kB
          John Edward Pedregosa

        Issue Links

          Activity

            People

              pholden Paul Holden
              pholden Paul Holden
              Ruslan Kabalin Ruslan Kabalin
              Jun Pataleta Jun Pataleta
              John Edward Pedregosa John Edward Pedregosa
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days, 6 hours, 50 minutes
                  2d 6h 50m

                  Clockify

                    Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.