Skip to content

Commit

Permalink
MDL-38661 JavaScript: Add missing lazy loading on collapseall
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Sep 18, 2013
1 parent abef633 commit dd834cb
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ NS.setup_keyboard_listeners = function() {
*/
NS.toggle_category_expansion = function(e) {
// Load the actual dependencies now that we've been called.
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim', function() {
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim-node-plugin', function() {
// Overload the toggle_category_expansion with the _toggle_category_expansion function to ensure that
// this function isn't called in the future, and call it for the first time.
NS.toggle_category_expansion = NS._toggle_category_expansion;
Expand All @@ -108,7 +108,7 @@ NS.toggle_category_expansion = function(e) {
*/
NS.toggle_coursebox_expansion = function(e) {
// Load the actual dependencies now that we've been called.
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim', function() {
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim-node-plugin', function() {
// Overload the toggle_coursebox_expansion with the _toggle_coursebox_expansion function to ensure that
// this function isn't called in the future, and call it for the first time.
NS.toggle_coursebox_expansion = NS._toggle_coursebox_expansion;
Expand Down Expand Up @@ -263,7 +263,26 @@ NS.run_expansion = function(categorynode) {
categorychildren.fx.run();
};

/**
* Toggle collapsing of all nodes.
*
* @method collapse_expand_all
* @private
* @param {EventFacade} e
*/
NS.collapse_expand_all = function(e) {
// Load the actual dependencies now that we've been called.
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim-node-plugin', function() {
// Overload the collapse_expand_all with the _collapse_expand_all function to ensure that
// this function isn't called in the future, and call it for the first time.
NS.collapse_expand_all = NS._collapse_expand_all;
NS.collapse_expand_all(e);
});

e.preventDefault();
};

NS._collapse_expand_all = function(e) {
// The collapse/expand button has no actual target but we need to prevent it's default
// action to ensure we don't make the page reload/jump.
e.preventDefault();
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ NS.setup_keyboard_listeners = function() {
*/
NS.toggle_category_expansion = function(e) {
// Load the actual dependencies now that we've been called.
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim', function() {
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim-node-plugin', function() {
// Overload the toggle_category_expansion with the _toggle_category_expansion function to ensure that
// this function isn't called in the future, and call it for the first time.
NS.toggle_category_expansion = NS._toggle_category_expansion;
Expand All @@ -107,7 +107,7 @@ NS.toggle_category_expansion = function(e) {
*/
NS.toggle_coursebox_expansion = function(e) {
// Load the actual dependencies now that we've been called.
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim', function() {
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim-node-plugin', function() {
// Overload the toggle_coursebox_expansion with the _toggle_coursebox_expansion function to ensure that
// this function isn't called in the future, and call it for the first time.
NS.toggle_coursebox_expansion = NS._toggle_coursebox_expansion;
Expand Down Expand Up @@ -262,7 +262,26 @@ NS.run_expansion = function(categorynode) {
categorychildren.fx.run();
};

/**
* Toggle collapsing of all nodes.
*
* @method collapse_expand_all
* @private
* @param {EventFacade} e
*/
NS.collapse_expand_all = function(e) {
// Load the actual dependencies now that we've been called.
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim-node-plugin', function() {
// Overload the collapse_expand_all with the _collapse_expand_all function to ensure that
// this function isn't called in the future, and call it for the first time.
NS.collapse_expand_all = NS._collapse_expand_all;
NS.collapse_expand_all(e);
});

e.preventDefault();
};

NS._collapse_expand_all = function(e) {
// The collapse/expand button has no actual target but we need to prevent it's default
// action to ensure we don't make the page reload/jump.
e.preventDefault();
Expand Down
23 changes: 21 additions & 2 deletions course/yui/src/categoryexpander/js/categoryexpander.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ NS.setup_keyboard_listeners = function() {
*/
NS.toggle_category_expansion = function(e) {
// Load the actual dependencies now that we've been called.
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim', function() {
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim-node-plugin', function() {
// Overload the toggle_category_expansion with the _toggle_category_expansion function to ensure that
// this function isn't called in the future, and call it for the first time.
NS.toggle_category_expansion = NS._toggle_category_expansion;
Expand All @@ -106,7 +106,7 @@ NS.toggle_category_expansion = function(e) {
*/
NS.toggle_coursebox_expansion = function(e) {
// Load the actual dependencies now that we've been called.
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim', function() {
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim-node-plugin', function() {
// Overload the toggle_coursebox_expansion with the _toggle_coursebox_expansion function to ensure that
// this function isn't called in the future, and call it for the first time.
NS.toggle_coursebox_expansion = NS._toggle_coursebox_expansion;
Expand Down Expand Up @@ -261,7 +261,26 @@ NS.run_expansion = function(categorynode) {
categorychildren.fx.run();
};

/**
* Toggle collapsing of all nodes.
*
* @method collapse_expand_all
* @private
* @param {EventFacade} e
*/
NS.collapse_expand_all = function(e) {
// Load the actual dependencies now that we've been called.
Y.use('io-base', 'json-parse', 'moodle-core-notification', 'anim-node-plugin', function() {
// Overload the collapse_expand_all with the _collapse_expand_all function to ensure that
// this function isn't called in the future, and call it for the first time.
NS.collapse_expand_all = NS._collapse_expand_all;
NS.collapse_expand_all(e);
});

e.preventDefault();
};

NS._collapse_expand_all = function(e) {
// The collapse/expand button has no actual target but we need to prevent it's default
// action to ensure we don't make the page reload/jump.
e.preventDefault();
Expand Down

0 comments on commit dd834cb

Please sign in to comment.