Merge branch 'MDL-63457-master' of git://github.com/peterRd/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 1 Nov 2018 07:03:34 +0000 (15:03 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 1 Nov 2018 07:03:34 +0000 (15:03 +0800)
1  2 
blocks/myoverview/amd/build/view.min.js
blocks/myoverview/amd/src/view.js
blocks/myoverview/lang/en/block_myoverview.php
blocks/myoverview/templates/course-action-menu.mustache
blocks/myoverview/templates/view-cards.mustache
blocks/myoverview/templates/view-list.mustache
blocks/myoverview/templates/view-summary.mustache
course/externallib.php

index a278dcb,916b0d0..f674567
Binary files differ
@@@ -30,7 -29,7 +30,8 @@@ define
      'core/custom_interaction_events',
      'core/notification',
      'core/templates',
-     'core_course/events'
++    'core_course/events',
+     'block_myoverview/selectors'
  ],
  function(
      $,
@@@ -40,7 -38,7 +41,8 @@@
      CustomEvents,
      Notification,
      Templates,
-     CourseEvents
++    CourseEvents,
+     Selectors
  ) {
  
      var SELECTORS = {
  
                  pagesData.forEach(function(pageData) {
                      var currentPage = pageData.pageNumber;
-                     var pageNumber = pageData.pageNumber - 1;
+                     var limit = pageData.limit;
+                     if (lastPage == currentPage) {
+                         // If we are on the last page and have it's data then load it from cache
+                         actions.allItemsLoaded(lastPage);
+                         promises.push(renderCourses(root, loadedPages[currentPage]));
 -                        return true;
++                        return;
+                     }
+                     // Get 2 pages worth of data as we will need it for the hidden functionality.
+                     if (loadedPages[currentPage + 1] == undefined) {
+                         if (loadedPages[currentPage] == undefined) {
+                             limit *= 2;
+                         }
+                     }
  
                      var pagePromise = getMyCourses(
                          filters,
@@@ -45,7 -48,9 +45,8 @@@ $string['aria:summary'] = 'Switch to su
  $string['aria:sortingdropdown'] = 'Sorting dropdown';
  $string['card'] = 'Card';
  $string['cards'] = 'Cards';
+ $string['courseprogress'] = 'Course progress:';
  $string['complete'] = 'Complete';
 -$string['favourite'] = 'Starred course';
  $string['favourites'] = 'Starred';
  $string['future'] = 'Future';
  $string['inprogress'] = 'In progress';
  
  <div class="card-deck dashboard-card-deck" role="list">
  {{#courses}}
-     <div class="card dashboard-card" role="listitem">
+     <div class="card dashboard-card" role="listitem"
+         data-region="course-content"
+         data-course-id="{{{id}}}">
          <a href="{{viewurl}}" tabindex="-1">
              <div class="card-img dashboard-card-img" style='background-image: url("{{{courseimage}}}");'>
 -                <span class="sr-only">{{#str}}aria:courseimage, block_myoverview{{/str}}</span>
 -                {{> block_myoverview/favourite-icon }}
 +                <span class="sr-only">{{#str}}aria:courseimage, core_course{{/str}}</span>
 +                {{> core_course/favouriteicon }}
              </div>
          </a>
          <div class="card-body pr-1 course-info-container" id="course-info-container-{{id}}">
Simple merge