block-navigation MDL-22044 Level 1 branches are no longer indented, and home/myhome link is no longer collapsible. Also fixed the everything bold issue

This commit is contained in:
Sam Hemelryk
2010-04-22 07:51:52 +00:00
parent dd8e50113a
commit d24016944f
3 changed files with 15 additions and 6 deletions
+7 -2
View File
@@ -225,10 +225,15 @@ M.block_navigation.classes.tree.prototype.toggleexpansion = function(e) {
}
if (e.target.get('nodeName').toUpperCase() == 'LI') {
e.target.toggleClass('collapsed');
var target = e.target;
} else if (e.target.ancestor('LI')) {
e.target.ancestor('LI').toggleClass('collapsed');
var target = e.target.ancestor('LI');
}
if (target && !target.hasClass('depth_1')) {
target.toggleClass('collapsed');
}
if (this.candock) {
M.core_dock.resize();
}
+4 -3
View File
@@ -3,6 +3,7 @@
class block_navigation_renderer extends plugin_renderer_base {
public function navigation_tree(global_navigation $navigation, $expansionlimit) {
$navigation->add_class('navigation_node');
$content = $this->navigation_node(array($navigation), array('class'=>'block_tree list'), $expansionlimit);
if (isset($navigation->id) && !is_numeric($navigation->id) && !empty($content)) {
$content = $this->output->box($content, 'block_tree_box', $navigation->id);
@@ -10,7 +11,7 @@ class block_navigation_renderer extends plugin_renderer_base {
return $content;
}
protected function navigation_node($items, $attrs=array(), $expansionlimit=null) {
protected function navigation_node($items, $attrs=array(), $expansionlimit=null, $depth=1) {
// exit if empty, we don't want an empty ul element
if (count($items)==0) {
@@ -66,7 +67,7 @@ class block_navigation_renderer extends plugin_renderer_base {
}
// this applies to the li item which contains all child lists too
$liclasses = array($item->get_css_type());
$liclasses = array($item->get_css_type(), 'depth_'.$depth);
if ($item->has_children() && (!$item->forceopen || $item->collapse)) {
$liclasses[] = 'collapsed';
}
@@ -88,7 +89,7 @@ class block_navigation_renderer extends plugin_renderer_base {
if (!empty($item->id)) {
$divattr['id'] = $item->id;
}
$content = html_writer::tag('p', $content, $divattr) . $this->navigation_node($item->children, array(), $expansionlimit);
$content = html_writer::tag('p', $content, $divattr) . $this->navigation_node($item->children, array(), $expansionlimit, $depth+1);
if (!empty($item->preceedwithhr) && $item->preceedwithhr===true) {
$content = html_writer::empty_tag('hr') . $content;
}
+4 -1
View File
@@ -6,11 +6,14 @@
/** General display rules **/
.block_navigation .block_tree {margin:5px;padding-left:0px;overflow:visible;}
.block_navigation .block_tree li {margin:0;list-style: none;}
.block_navigation .block_tree li ul {padding-left:16px;margin:0;}
.block_navigation .block_tree li ul {padding-left:0;margin:0;}
.block_navigation .block_tree li.depth_2 ul {padding-left:16px;margin:0;}
.block_navigation .block_tree .tree_item {padding-left: 16px;margin:3px 0px;text-align:left;}
.block_navigation .block_tree .tree_item.branch {background-image: url([[pix:t/expanded]]);background-position: center left;background-repeat: no-repeat;}
.block_navigation .block_tree .navigation_node.tree_item.branch {background-image:none;padding-left:0;}
.block_navigation .block_tree .root_node.leaf {padding-left:0px;}
.block_navigation .block_tree .current_branch {font-weight:bold;}
.block_navigation .block_tree .depth_1.current_branch ul {font-weight:normal;}
.jsenabled .block_navigation .block_tree .tree_item.branch {cursor:pointer;}
.jsenabled .block_navigation .block_tree .tree_item.emptybranch {background-image: url([[pix:t/collapsed_empty]]);background-position: center left;background-repeat: no-repeat;}
.jsenabled .block_navigation .block_tree .collapsed ul {display: none;}