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

Allow easy setting of the active tab for the navigation views.

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_400_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-72396-master
    • Testing Instructions:
      Hide

      Prerequisites

      1. To test this changeset the primary and secondary nav should be available on your instance.
      2. Also, I have tested this on top of the changes made for MDL-71915.

      Steps to test for secondary nav

      1. Enable quiz module.
      2. Open the file mod/quiz/edit.php
      3. Now add the line:

         $PAGE->set_secondary_active_tab('questionbank'); 
        

      4. Now navigate to the edit page of the quiz module.
      5. You should see the "More" tab in the secondary nav activated (as "Question bank" tab is inside the More menu)
      6. Now change the line mentioned in step 3 to:

        $PAGE->set_secondary_active_tab('mod_quiz_useroverrides'); 
        

      7. And reload the page. You should see the "Overrides" tab in the secondary nav activated.

      Steps to test for primary nav

      1. Enable quiz module.
      2. Open the file mod/quiz/edit.php
      3. Now add the line:

         $PAGE->set_primary_active_tab('courses');

      4. Now navigate to the edit page of the quiz.
      5. You should see the primary nav activated for "Courses".
      6. Replace the line in step 3 to:

      $PAGE->set_primary_active_tab('myhome');
      

      # Now reload the edit page of the quiz module. You should see the primary nav activated for "Dashboard".

       

      Show
      Prerequisites To test this changeset the primary and secondary nav should be available on your instance. Also, I have tested this on top of the changes made for MDL-71915 . Steps to test for secondary nav Enable quiz module. Open the file mod/quiz/edit.php Now add the line: $PAGE->set_secondary_active_tab( 'questionbank' ); Now navigate to the edit page of the quiz module. You should see the "More" tab in the secondary nav activated (as "Question bank" tab is inside the More menu) Now change the line mentioned in step 3 to: $PAGE->set_secondary_active_tab( 'mod_quiz_useroverrides' ); And reload the page. You should see the "Overrides" tab in the secondary nav activated. Steps to test for primary nav Enable quiz module. Open the file mod/quiz/edit.php Now add the line: $PAGE->set_primary_active_tab( 'courses' ); Now navigate to the edit page of the quiz. You should see the primary nav activated for "Courses". Replace the line in step 3 to: $PAGE->set_primary_active_tab( 'myhome' ); # Now reload the edit page of the quiz module. You should see the primary nav activated for "Dashboard".  
    • Story Points:
      3
    • Sprint:
      Navigation push 5, Navigation push 6

      Description

      Sometimes we want to highlight a tab in one of the navigation views when it does not match the set url for that navigation node.

      Currently making this work requires a lot of additional code and overwriting the views.

      To try and help third party developers (and ourselves) let's provide a simple method that can be called to set the active tab.

      Something like:

      $PAGE->set_secondary_active_tab($navkey);
      

      Where the navkey is the key given to the node that represents the tab we want active.
      This could be useful for the primary navigation as well.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sujith Sujith Haridasan
              Reporter:
              abgreeve Adrian Greeve
              Peer reviewer:
              Mihail Geshoski Mihail Geshoski
              Integrator:
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Tester:
              Gladys Basiana Gladys Basiana
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              8 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 - 3 days, 2 hours, 43 minutes
                  3d 2h 43m