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

Default tab in the activity chooser should be recommended activities

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.9.3
    • Fix Version/s: None
    • Component/s: Course, JavaScript
    • Labels:
      None
    • Affected Branches:
      MOODLE_39_STABLE

      Description

      This is a suggestion of a better way to cascade the default tabs in the activity chooser so that schools can make it easier to find the main activities (which would be checked off in the recommended activity settings) without having to wade through all the activities when the list is lengthy.

      Our university has a lot of activities because we span the gamut from sciences and engineering to the humanities. We also have a lot of instructors who are new to moodle and feel overwhelmed to see so many activities. To simplify the activity chooser, we have modified the javascript file activitychooser.js to open up with the recommended activities by default, then starred activities, then all activities as the last choice.

      This lets us select the most frequently-used activities in the settings as recommended and makes it simpler for the new instructor to find what they are looking for and not be overwhelmed with choices.

      Here's the change I made. Maybe the moodle community would consider a similar change.

      // We have some favourites.
      {{ const favouritesFirst = !!favourites.length;}}
      {{ // ADD - recommendedFirst is a fallback for favorites.}}
      const recommendedFirst = recommended.length > 0 && !favouritesFirst;
      {{ // We are in tabMode 2 without any favourites.}}
      {{ const activitiesFirst = showAll === false && favouritesFirst === false;}}
      {{ // We have nothing fallback to show all modules.}}
      {{ // ADD - add recommendedFirst as a check.}}
      {{ const fallback = showAll === true && favouritesFirst === false && recommendedFirst === false;}}

      return {
      {{ 'default': data,}}
      {{ showAll: showAll,}}
      {{ activities: activities,}}
      {{ showActivities: showActivities,}}
      {{ activitiesFirst: activitiesFirst,}}
      {{ resources: resources,}}
      {{ showResources: showResources,}}
      {{ favourites: favourites,}}
      {{ recommended: recommended,}}
      {{ favouritesFirst: favouritesFirst,}}
      {{ fallback: fallback,}}
      {{ // ADD - add recommendedFirst.}}
      recommendedFirst: recommendedFirst,
      {{ };}}

      In the mustache template activitychooser.mustache, on the recommended tab nav-item HTML:

      {{ aria-selected="#recommendedFirst}}true{{/recommendedFirst^recommendedFirst}}false{{/recommendedFirst"}}
      {{ tabindex="#recommendedFirst}}0{{/recommendedFirst^recommendedFirst-1{{/recommendedFirst}}"}}

      And in the same file, in the recommended tab-pane HTML:

      }}{{<div class="tab-pane {{#recommendedFirst}}active{{/recommendedFirst"}}

      I hope that is useful to someone.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            dsoini Diane Soini
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona), Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: