Permalink
Browse files

Enhanced navigation and sidebar support

  • Loading branch information...
1 parent 2614c02 commit 50cc5d80ce210e660565bcb895b85db885cfd0b2 @thelfensdrfer thelfensdrfer committed Nov 13, 2013
Showing with 16 additions and 15 deletions.
  1. +2 −1 EBootstrapNavigation.php
  2. +14 −14 EBootstrapSidebar.php
View
@@ -85,6 +85,8 @@ public function renderMenu($items) {
echo EBootstrap::openTag('span', array('class' => 'icon-bar'));
echo EBootstrap::closeTag('span')."\n";
}
+ echo EBootstrap::closeTag('button')."\n";
+
for ($i = 0; $i < count($items); $i++) {
if (isset($items[$i]['template']) and ($items[$i]['template']) == '{brand}') {
$options = isset($items[$i]['itemOptions']) ? $items[$i]['itemOptions'] : array();
@@ -94,7 +96,6 @@ public function renderMenu($items) {
break;
}
}
- echo EBootstrap::closeTag('button')."\n";
echo EBootstrap::closeTag('div')."\n";
View
@@ -1,10 +1,10 @@
-<?php
+<?php
Yii::import('zii.widgets.CMenu');
/**
* Render a sidebar
- *
+ *
* @author Tim Helfensdörfer <tim@visualappeal.de>
* @version 0.3.0
* @package bootstrap.widgets
@@ -16,17 +16,17 @@ class EBootstrapSidebar extends CMenu {
public function init()
{
echo EBootstrap::openTag('div', array('class' => 'well sidebar-nav'));
-
- EBootstrap::mergeClass($this->htmlOptions, array('nav', 'nav-list'));
+
+ EBootstrap::mergeClass($this->htmlOptions, array('nav', 'nav-pills', 'nav-stacked'));
parent::init();
}
-
+
public function run() {
parent::run();
-
+
echo EBootstrap::closeTag('div');
}
-
+
/**
* Recursively renders the menu items.
*
@@ -41,7 +41,7 @@ protected function renderMenuRecursive($items, $header = true) {
$prove = true;
else
$prove = false;
-
+
if (($prove and Yii::app()->user->checkAccess($item['access'])) or (!$prove)) {
$count++;
$options=isset($item['itemOptions']) ? $item['itemOptions'] : array();
@@ -62,28 +62,28 @@ protected function renderMenuRecursive($items, $header = true) {
else
$options['class'].=' '.implode(' ',$class);
}
-
+
echo EBootstrap::openTag('li', $options);
-
+
$menu=$this->renderMenuItem($item);
if(isset($this->itemTemplate) || isset($item['template'])) {
$template=isset($item['template']) ? $item['template'] : $this->itemTemplate;
echo strtr($template,array('{menu}'=>$menu));
}
else
echo $menu;
-
+
echo EBootstrap::closeTag('li');
-
+
if(isset($item['items']) && count($item['items'])) {
$this->renderMenuRecursive($item['items'], false);
}
-
+
echo "\n";
}
}
}
-
+
/**
* Renders the content of a menu item.
*

0 comments on commit 50cc5d8

Please sign in to comment.