mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-54722-master' of git://github.com/cameron1729/moodle
This commit is contained in:
commit
69dcebb04d
15 changed files with 84 additions and 26 deletions
2
blocks/navigation/amd/build/navblock.min.js
vendored
2
blocks/navigation/amd/build/navblock.min.js
vendored
|
@ -1 +1 @@
|
|||
define(["jquery","core/tree"],function(a,b){return{init:function(){new b(".block_navigation .block_tree")}}});
|
||||
define(["jquery","core/tree"],function(a,b){return{init:function(a){var c=new b(".block_navigation .block_tree");c.finishExpandingGroup=function(c){b.prototype.finishExpandingGroup.call(this,c),Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED,{instanceid:a})},c.collapseGroup=function(c){b.prototype.collapseGroup.call(this,c),Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED,{instanceid:a})}}}});
|
|
@ -23,8 +23,20 @@
|
|||
*/
|
||||
define(['jquery', 'core/tree'], function($, Tree) {
|
||||
return {
|
||||
init: function() {
|
||||
new Tree(".block_navigation .block_tree");
|
||||
init: function(instanceid) {
|
||||
var navTree = new Tree(".block_navigation .block_tree");
|
||||
navTree.finishExpandingGroup = function(item) {
|
||||
Tree.prototype.finishExpandingGroup.call(this, item);
|
||||
Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {
|
||||
instanceid: instanceid
|
||||
});
|
||||
};
|
||||
navTree.collapseGroup = function(item) {
|
||||
Tree.prototype.collapseGroup.call(this, item);
|
||||
Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {
|
||||
instanceid: instanceid
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
@ -108,8 +108,11 @@ class block_navigation extends block_base {
|
|||
*/
|
||||
function get_required_javascript() {
|
||||
parent::get_required_javascript();
|
||||
$arguments = array(
|
||||
'instanceid' => $this->instance->id
|
||||
);
|
||||
$this->page->requires->string_for_js('viewallcourses', 'moodle');
|
||||
$this->page->requires->js_call_amd('block_navigation/navblock', 'init', array());
|
||||
$this->page->requires->js_call_amd('block_navigation/navblock', 'init', $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1 +1 @@
|
|||
define(["jquery","core/tree"],function(a,b){return{init:function(a){var c=new b(".block_settings .block_tree");if(a){var d=c.treeRoot.find("#"+a),e=d.children("a").first();e.replaceWith('<span tabindex="0">'+e.html()+"</span>")}}}});
|
||||
define(["jquery","core/tree"],function(a,b){return{init:function(a,c){var d=new b(".block_settings .block_tree");if(c){var e=d.treeRoot.find("#"+c),f=e.children("a").first();f.replaceWith('<span tabindex="0">'+f.html()+"</span>")}d.finishExpandingGroup=function(c){b.prototype.finishExpandingGroup.call(this,c),Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED,{instanceid:a})},d.collapseGroup=function(c){b.prototype.collapseGroup.call(this,c),Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED,{instanceid:a})}}}});
|
|
@ -16,20 +16,32 @@
|
|||
/**
|
||||
* Load the settings block tree javscript
|
||||
*
|
||||
* @module block_navigation/navblock
|
||||
* @module block_settings/settingsblock
|
||||
* @package core
|
||||
* @copyright 2015 John Okely <john@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define(['jquery', 'core/tree'], function($, Tree) {
|
||||
return {
|
||||
init: function(siteAdminNodeId) {
|
||||
init: function(instanceid, siteAdminNodeId) {
|
||||
var adminTree = new Tree(".block_settings .block_tree");
|
||||
if (siteAdminNodeId) {
|
||||
var siteAdminNode = adminTree.treeRoot.find('#' + siteAdminNodeId);
|
||||
var siteAdminLink = siteAdminNode.children('a').first();
|
||||
siteAdminLink.replaceWith('<span tabindex="0">' + siteAdminLink.html() + '</span>');
|
||||
}
|
||||
adminTree.finishExpandingGroup = function(item) {
|
||||
Tree.prototype.finishExpandingGroup.call(this, item);
|
||||
Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {
|
||||
instanceid: instanceid
|
||||
});
|
||||
};
|
||||
adminTree.collapseGroup = function(item) {
|
||||
Tree.prototype.collapseGroup.call(this, item);
|
||||
Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {
|
||||
instanceid: instanceid
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
@ -91,18 +91,13 @@ class block_settings extends block_base {
|
|||
|
||||
function get_required_javascript() {
|
||||
global $PAGE;
|
||||
$adminnodeid = null;
|
||||
$adminnode = $PAGE->settingsnav->find('siteadministration', navigation_node::TYPE_SITE_ADMIN);
|
||||
if (!empty($adminnode)) {
|
||||
$adminnodeid = $adminnode->id;
|
||||
}
|
||||
parent::get_required_javascript();
|
||||
$arguments = array(
|
||||
'id' => $this->instance->id,
|
||||
'instance' => $this->instance->id,
|
||||
'candock' => $this->instance_can_be_docked()
|
||||
'instanceid' => $this->instance->id,
|
||||
'adminnodeid' => $adminnode ? $adminnode->id : null
|
||||
);
|
||||
$this->page->requires->js_call_amd('block_settings/settingsblock', 'init', array($adminnodeid));
|
||||
$this->page->requires->js_call_amd('block_settings/settingsblock', 'init', $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue