mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
navigation MDL-26875 Moved course type check into object check and moved JS string call to navigation block where the navigation JS is initialised.
This commit is contained in:
parent
c683165a4a
commit
4c2820fbd8
@ -118,6 +118,7 @@ class block_navigation extends block_base {
|
||||
'courselimit' => $limit,
|
||||
'expansionlimit' => $expansionlimit
|
||||
);
|
||||
$this->page->requires->string_for_js('viewallcourses', 'moodle');
|
||||
$this->page->requires->yui_module(array('core_dock', 'moodle-block_navigation-navigation'), 'M.block_navigation.init_add_tree', array($arguments));
|
||||
}
|
||||
|
||||
|
14
blocks/navigation/yui/navigation/navigation.js
vendored
14
blocks/navigation/yui/navigation/navigation.js
vendored
@ -310,16 +310,16 @@ BRANCH.prototype = {
|
||||
try {
|
||||
var object = Y.JSON.parse(outcome.responseText);
|
||||
if (object.children && object.children.length > 0) {
|
||||
var count = 0;
|
||||
var coursecount = 0;
|
||||
for (var i in object.children) {
|
||||
if (object.children[i].type == 20) {
|
||||
count++;
|
||||
}
|
||||
if (typeof(object.children[i])=='object') {
|
||||
if (object.children[i].type == 20) {
|
||||
coursecount++;
|
||||
}
|
||||
this.addChild(object.children[i]);
|
||||
}
|
||||
}
|
||||
if (this.get('type') == 10 && count >= M.block_navigation.courselimit) {
|
||||
if (this.get('type') == 10 && coursecount >= M.block_navigation.courselimit) {
|
||||
this.addViewAllCoursesChild(this);
|
||||
}
|
||||
this.get('tree').toggleExpansion({target:this.node});
|
||||
@ -357,7 +357,7 @@ BRANCH.prototype = {
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Add a link to view all courses in a category
|
||||
*/
|
||||
@ -455,4 +455,4 @@ M.block_navigation = M.block_navigation || {
|
||||
}
|
||||
};
|
||||
|
||||
}, '@VERSION@', {requires:['base', 'core_dock', 'io', 'node', 'dom', 'event-custom', 'event-delegate', 'json-parse']});
|
||||
}, '@VERSION@', {requires:['base', 'core_dock', 'io', 'node', 'dom', 'event-custom', 'event-delegate', 'json-parse']});
|
@ -1097,8 +1097,6 @@ class global_navigation extends navigation_node {
|
||||
} else if ($this->rootnodes['courses']->children->count() >= $limit) {
|
||||
$this->rootnodes['courses']->add(get_string('viewallcoursescategories'), new moodle_url('/course/index.php'), self::TYPE_SETTING);
|
||||
}
|
||||
|
||||
$this->page->requires->string_for_js('viewallcourses', 'moodle');
|
||||
|
||||
// Load for the current user
|
||||
$this->load_for_user();
|
||||
|
Loading…
x
Reference in New Issue
Block a user