Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Wrapped hero in div element #12 Added block element buttons, dark/whi…

…te navigation option and submenu dropdown for buttons #13
  • Loading branch information...
commit 9813f88bd747befcc61c009ba255ea427e87ad92 1 parent 6e3c58c
@thelfensdrfer thelfensdrfer authored
View
33 EBootstrap.php
@@ -5,7 +5,7 @@
* EBootstrap adds some bootstrap elements to CHtml
*
* @author Tim Helfensdörfer <tim@visualappeal.de>
- * @version 0.3.5
+ * @version 0.4.4
* @package bootstrap
*/
class EBootstrap extends CHtml {
@@ -66,9 +66,10 @@ public static function ilabel($label, $type='', $htmlOptions=array()) {
* @param string $icon http://twitter.github.com/bootstrap/base-css.html#icons (e.g. 'shopping-cart', 'user', 'ok', etc.)
* @param bool $iconWhite Invert the icon color. Default: false
* @param array $htmlOptions
+ * @param bool $block Block element
*/
- public static function ibutton($text, $url = '#', $type = '', $size = '', $disabled = false, $icon = '', $iconWhite = false, $htmlOptions = array()) {
- return new EBootstrapButton($text, $url, $type, $size, $disabled, $icon, $iconWhite, $htmlOptions);
+ public static function ibutton($text, $url = '#', $type = '', $size = '', $disabled = false, $icon = '', $iconWhite = false, $htmlOptions = array(), $block = false) {
+ return new EBootstrapButton($text, $url, $type, $size, $disabled, $icon, $iconWhite, $htmlOptions, $block);
}
/**
@@ -152,12 +153,26 @@ public static function buttonDropdown(EBootstrapButton $button, $submenuItems =
if (is_array($submenuItems) and (count($submenuItems))) {
$html .= self::openTag('ul', array('class' => 'dropdown-menu'))."\n";
foreach ($submenuItems as $item) {
- $html .= self::openTag('li')."\n";
-
- $itemOptions = isset($item['htmlOptions']) ? $item['htmlOptions'] : array();
- $html .= self::link($item['text'], $item['url'], $itemOptions)."\n";
-
- $html .= self::closeTag('li')."\n";
+ if (isset($item['submenu'])) {
+ $html .= self::openTag('li', array('class' => 'dropdown-submenu'))."\n";
+ $html .= self::tag('a', array('tabindex' => -1, 'href' => $item['url']), $item['text']);
+ $html .= self::openTag('ul', array('class' => 'dropdown-menu'))."\n";
+ foreach ($item['submenu'] as $subSubMenuItem) {
+ $html .= self::openTag('li')."\n";
+ $itemOptions = isset($subSubMenuItem['htmlOptions']) ? $subSubMenuItem['htmlOptions'] : array();
+ $html .= self::link($subSubMenuItem['text'], $subSubMenuItem['url'], $itemOptions)."\n";
+ $html .= self::closeTag('li')."\n";
+ }
+ $html .= self::closeTag('ul')."\n";
+ }
+ else {
+ $html .= self::openTag('li')."\n";
+
+ $itemOptions = isset($item['htmlOptions']) ? $item['htmlOptions'] : array();
+ $html .= self::link($item['text'], $item['url'], $itemOptions)."\n";
+
+ $html .= self::closeTag('li')."\n";
+ }
}
$html .= self::closeTag('ul')."\n";
}
View
14 EBootstrapButton.php
@@ -4,7 +4,7 @@
* Class for creating a button
*
* @author Tim Helfensdörfer <tim@visualappeal.de>
- * @version 0.3.2
+ * @version 0.4.4
* @package bootstrap
*/
class EBootstrapButton {
@@ -53,6 +53,13 @@ class EBootstrapButton {
public $htmlOptions;
/**
+ * Block element (same width as parent element)
+ *
+ * @since 0.4.4
+ */
+ public $block;
+
+ /**
* Button type
*
* Possible values:
@@ -75,7 +82,7 @@ class EBootstrapButton {
* @param bool $iconWhite Invert the icon color. Default: false
* @param array $htmlOptions
*/
- public function __construct($text, $url = '#', $type = '', $size = '', $disabled = false, $icon = '', $iconWhite = false, $htmlOptions = array(), $element = 'a') {
+ public function __construct($text, $url = '#', $type = '', $size = '', $disabled = false, $icon = '', $iconWhite = false, $htmlOptions = array(), $element = 'a', $block = false) {
$this->text = $text;
$this->url = $url;
$this->type = $type;
@@ -106,6 +113,9 @@ public function __tostring() {
if ($this->disabled)
$class[] = 'disabled';
+ if ($this->block)
+ $class[] = 'btn-block';
+
if (!empty($this->icon))
$this->text = EBootstrap::icon($this->icon, $this->iconWhite).' '.$this->text;
View
2  EBootstrapHero.php
@@ -42,7 +42,7 @@ public function run() {
echo EBootstrap::openTag('div', $this->htmlOptions)."\n";
echo EBootstrap::tag('h1', array(), $this->headline)."\n";
- echo EBootstrap::tag('p', array(), $this->body)."\n";
+ echo EBootstrap::tag('div', array(), $this->body)."\n";
if (!empty($this->actions)) {
echo EBootstrap::openTag('p');
foreach ($this->actions as $button) {
View
16 EBootstrapNavigation.php
@@ -7,25 +7,31 @@
* http://twitter.github.com/bootstrap/components.html#navbar
*
* @author Tim Helfensdörfer <tim@visualappeal.de>
- * @version 0.3.9
+ * @version 0.4.4
* @package bootstrap.widgets
*/
class EBootstrapNavigation extends CMenu {
private $_ul = 0;
/**
- * Stay at top of the page
+ * @var Stay at top of the page
*/
public $fixed = false;
/**
- * Responsive navigation bar. Hides on small screens and add a dropdown for the elements
+ * @var Responsive navigation bar. Hides on small screens and add a dropdown for the elements
*/
public $responsive = false;
/**
- * Javascript file to hide the alert.
+ * @var Set to true to get a dark navigation bar
*
+ * @since 0.4.4
+ */
+ public $dark = false;
+
+ /**
+ * @var Javascript file to hide the alert.
* If its set to false, no file will be included
*/
public $jsFile = null;
@@ -37,6 +43,8 @@ public function init() {
parent::init();
EBootstrap::mergeClass($this->htmlOptions, array('navbar'));
+ if ($this->dark)
+ EBootstrap::mergeClass($this->htmlOptions, array('navbar-inverse'));
Yii::app()->clientScript->registerCoreScript('jquery');
if (is_null($this->jsFile)) {
Please sign in to comment.
Something went wrong with that request. Please try again.