Skip to content

Commit

Permalink
Merge branch 'MDL-71157-310' of git://github.com/sarjona/moodle into …
Browse files Browse the repository at this point in the history
…MOODLE_310_STABLE
  • Loading branch information
junpataleta committed May 20, 2021
2 parents 0653fc4 + 7efc2ae commit f5fb446
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 11 deletions.
Expand Up @@ -147,7 +147,6 @@ Feature: My overview block pagination
| student1 | C13 | student |
When I log in as "student1"
And I click on "[data-control='next']" "css_element" in the "Course overview" "block"
And I wait until ".block_myoverview [data-control='next']" "css_element" exists
Then the "class" attribute of ".block_myoverview [data-control='next']" "css_element" should contain "disabled"
And I log out

Expand Down Expand Up @@ -181,7 +180,6 @@ Feature: My overview block pagination
| student1 | C25 | student |
When I log in as "student1"
And I click on "[data-control='next']" "css_element" in the "Course overview" "block"
And I wait until ".block_myoverview [data-control='next']" "css_element" exists
Then the "class" attribute of ".block_myoverview [data-control='next']" "css_element" should not contain "disabled"
And the "class" attribute of ".block_myoverview [data-control='previous']" "css_element" should not contain "disabled"
And I should see "Course 13" in the "Course overview" "block"
Expand Down
2 changes: 1 addition & 1 deletion lib/amd/build/paged_content_pages.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/amd/build/paged_content_pages.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/amd/build/paged_content_paging_bar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/amd/build/paged_content_paging_bar.min.js.map

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions lib/amd/src/paged_content_pages.js
Expand Up @@ -26,14 +26,16 @@ define(
'core/templates',
'core/notification',
'core/pubsub',
'core/paged_content_events'
'core/paged_content_events',
'core/pending',
],
function(
$,
Templates,
Notification,
PubSub,
PagedContentEvents
PagedContentEvents,
Pending
) {

var SELECTORS = {
Expand Down Expand Up @@ -74,6 +76,8 @@ define(
var deferred = $.Deferred();
root.attr('aria-busy', true);

var pendingPromise = new Pending('core/paged_content_pages:startLoading');

Templates.render(TEMPLATES.LOADING, {visible: true})
.then(function(html) {
var loadingSpinner = $(html);
Expand All @@ -93,6 +97,8 @@ define(
loadingSpinner.remove();
root.css('position', '');
root.removeAttr('aria-busy');

pendingPromise.resolve();
return;
});

Expand Down Expand Up @@ -182,6 +188,7 @@ define(
* @param {function} renderPagesContentCallback Render pages content.
*/
var showPages = function(root, pagesData, id, renderPagesContentCallback) {
var pendingPromise = new Pending('core/paged_content_pages:showPages');
var existingPages = [];
var newPageData = [];
var newPagesPromise = $.Deferred();
Expand Down Expand Up @@ -256,7 +263,9 @@ define(
.fail(Notification.exception)
.always(function() {
loadingPromise.resolve();
});
pendingPromise.resolve();
})
.catch();
};

/**
Expand Down
9 changes: 7 additions & 2 deletions lib/amd/src/paged_content_paging_bar.js
Expand Up @@ -25,14 +25,16 @@ define([
'core/custom_interaction_events',
'core/paged_content_events',
'core/str',
'core/pubsub'
'core/pubsub',
'core/pending',
],
function(
$,
CustomEvents,
PagedContentEvents,
Str,
PubSub
PubSub,
Pending
) {

var SELECTORS = {
Expand Down Expand Up @@ -451,6 +453,7 @@ function(
* @param {string} id A uniqie id for this instance.
*/
var showPage = function(root, pageNumber, id) {
var pendingPromise = new Pending('core/paged_content_paging_bar:showPage');
var lastPageNumber = getLastPageNumber(root);
var isSamePage = pageNumber == getActivePageNumber(root);
var limit = getLimit(root);
Expand Down Expand Up @@ -492,6 +495,8 @@ function(
limit: limit,
offset: offset
}]);

pendingPromise.resolve();
};

/**
Expand Down

0 comments on commit f5fb446

Please sign in to comment.