Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

B3 Compatible flash messages, icons, buttons and button groups.

  • Loading branch information...
commit fe23c1f46433e073a3524631d06ba9ace90c7633 1 parent be1ddb9
@thelfensdrfer thelfensdrfer authored
View
15 EBootstrap.php
@@ -122,11 +122,14 @@ public static function ibutton($text, $url = '#', $type = '', $size = '', $disab
* @access public
* @return string
*/
- public static function buttonGroup($buttons, $htmlOptions = array()) {
+ public static function buttonGroup($buttons, $htmlOptions = array(), $size = '') {
$html = '';
if (is_array($buttons) and (count($buttons))) {
self::mergeClass($htmlOptions, array('btn-group'));
+ if (!empty($size))
+ self::mergeClass($htmlOptions, array('btn-group-' . $size));
+
$html .= self::openTag('div', $htmlOptions)."\n";
foreach ($buttons as $button) {
$html .= $button."\n";
@@ -253,18 +256,18 @@ public static function buttonDropdown(EBootstrapButton $button, $submenuItems =
* @return string
*/
public static function icon($icon, $iconWhite = false, $htmlOptions = array()) {
- $classes = array('icon-' . $icon);
+ $classes = array('glyphicon glyphicon-' . $icon);
if ($iconWhite)
- $classes[] = 'icon-white';
+ $classes[] = 'glyphicon-white';
EBootstrap::mergeClass($htmlOptions, $classes);
- $return = '<i class="' . $htmlOptions['class'] . '"';
+ $return = '<span class="' . $htmlOptions['class'] . '"';
if (isset($htmlOptions['id']))
$return .= ' id="' . $htmlOptions['id'] . '"';
- return $return.'></i>';
+ return $return.'></span>';
}
/** IMAGES */
@@ -605,4 +608,4 @@ public static function errorSummary($model,$header=null,$footer=null,$htmlOption
}
}
-EBootstrap::$afterRequiredLabel = ' <span class="required">' . Yii::t('Site', '(Required)') . '</span>';
+EBootstrap::$afterRequiredLabel = ' <span class="required">' . Yii::t('YiiBootstrap', '(Required)') . '</span>';
View
3  EBootstrapActiveForm.php
@@ -397,6 +397,7 @@ private function _endBootstrapGroup($model, $attribute) {
* @return string html
*/
public function bootstrapTextField($model, $attribute, $htmlOptions = array()) {
+ EBootstrap::mergeClass($htmlOptions, array('form-control'));
$html = $this->_beginBootstrapGroup($model, $attribute);
$html .= $this->textField($model, $attribute, $htmlOptions);
$html .= $this->_endBootstrapGroup($model, $attribute);
@@ -416,6 +417,7 @@ public function bootstrapTextField($model, $attribute, $htmlOptions = array()) {
* @return string html
*/
public function bootstrapTextArea($model, $attribute, $htmlOptions = array()) {
+ EBootstrap::mergeClass($htmlOptions, array('form-control'));
$html = $this->_beginBootstrapGroup($model, $attribute);
$html .= $this->textArea($model, $attribute, $htmlOptions);
$html .= $this->_endBootstrapGroup($model, $attribute);
@@ -454,6 +456,7 @@ public function bootstrapCheckBox($model, $attribute, $htmlOptions = array()) {
* @return string html
*/
public function bootstrapPasswordField($model, $attribute, $htmlOptions = array()) {
+ EBootstrap::mergeClass($htmlOptions, array('form-control'));
$html = $this->_beginBootstrapGroup($model, $attribute);
$html .= $this->passwordField($model, $attribute, $htmlOptions);
$html .= $this->_endBootstrapGroup($model, $attribute);
View
16 EBootstrapAlert.php
@@ -5,14 +5,14 @@
* http://twitter.github.com/bootstrap/javascript.html#alerts
*
* @author Tim Helfensdörfer <tim@visualappeal.de>
- * @version 0.3.0
+ * @version 1.0.0
* @package bootstrap.widgets
*/
class EBootstrapAlert extends EBootstrapWidget {
/**
* Type of the alert
*
- * Values: warning|error|success|info
+ * Values: warning|danger|success|info
*/
public $type = '';
@@ -60,17 +60,17 @@ public function init() {
*/
public function run() {
parent::run();
+
+ if ($this->type == 'error')
+ $this->type = 'danger';
- EBootstrap::mergeClass($this->htmlOptions, array('alert', 'fade', 'in'));
- EBootstrap::mergeClass($this->htmlOptions, array('alert-'.$this->type));
-
- if ($this->block)
- EBootstrap::mergeClass($this->htmlOptions, array('alert-block'));
+ EBootstrap::mergeClass($this->htmlOptions, array('alert', 'alert-dismissable', 'fade', 'in'));
+ EBootstrap::mergeClass($this->htmlOptions, array('alert-' . $this->type));
echo EBootstrap::openTag('div', $this->htmlOptions);
if ($this->canClose)
- echo EBootstrap::tag('a', array('href' => '#', 'class' => 'close', 'data-dismiss' => 'alert'), "&times;");
+ echo EBootstrap::tag('button', array('type' => 'button', 'class' => 'close', 'data-dismiss' => 'alert', 'aria-hidden' => 'true'), "&times;");
if ($this->block)
echo $this->message;
View
2  EBootstrapButton.php
@@ -110,6 +110,8 @@ public function __tostring() {
if (!empty($this->type))
$class[] = 'btn-'.$this->type;
+ else
+ $class[] = 'btn-default';
if ($this->disabled)
$class[] = 'disabled';
View
65 EBootstrapNavigation.php
@@ -7,7 +7,7 @@
* http://twitter.github.com/bootstrap/components.html#navbar
*
* @author Tim Helfensdörfer <tim@visualappeal.de>
- * @version 0.4.4
+ * @version 1.0.0
* @package bootstrap.widgets
*/
class EBootstrapNavigation extends CMenu {
@@ -16,12 +16,14 @@ class EBootstrapNavigation extends CMenu {
/**
* @var Stay at top of the page
*/
- public $fixed = false;
-
+ public $static = false;
+
/**
- * @var Responsive navigation bar. Hides on small screens and add a dropdown for the elements
+ * @var Apply default style
+ *
+ * @since 1.0.0
*/
- public $responsive = false;
+ public $default = true;
/**
* @var Set to true to get a dark navigation bar
@@ -45,6 +47,8 @@ public function init() {
EBootstrap::mergeClass($this->htmlOptions, array('navbar'));
if ($this->dark)
EBootstrap::mergeClass($this->htmlOptions, array('navbar-inverse'));
+ if ($this->default)
+ EBootstrap::mergeClass($this->htmlOptions, array('navbar-default'));
Yii::app()->clientScript->registerCoreScript('jquery');
if (is_null($this->jsFile)) {
@@ -66,42 +70,37 @@ public function run() {
*/
public function renderMenu($items) {
if (count($items)) {
- if ($this->fixed)
- EBootstrap::mergeClass($this->htmlOptions, array('navbar-fixed-top'));
- echo EBootstrap::openTag('div', $this->htmlOptions)."\n";
-
- $innerOptions = array('class' => 'navbar-inner');
+ if ($this->static)
+ EBootstrap::mergeClass($this->htmlOptions, array('navbar-static-top'));
+ $this->htmlOptions['role'] = 'navigation';
- echo EBootstrap::openTag('div', $innerOptions)."\n";
+ echo EBootstrap::openTag('nav', $this->htmlOptions)."\n";
echo EBootstrap::openTag('div', array('class' => 'container'))."\n";
+
+ echo EBootstrap::openTag('div', array('class' => 'navbar-header'))."\n";
- if ($this->responsive) {
- echo EBootstrap::openTag('a', array('class' => 'btn btn-navbar', 'data-toggle' => 'collapse', 'data-target' => '.nav-collapse'))."\n";
- for ($i = 0; $i < 3; $i++) {
- echo EBootstrap::openTag('span', array('class' => 'icon-bar'));
- echo EBootstrap::closeTag('span')."\n";
- }
- echo EBootstrap::closeTag('a')."\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();
- EBootstrap::mergeClass($options, array('brand'));
- echo EBootstrap::link($items[$i]['label'],$items[$i]['url'],$options)."\n";
- unset($items[$i]);
- break;
- }
+ echo EBootstrap::openTag('button', array('type' => 'button', 'class' => 'navbar-toggle', 'data-toggle' => 'collapse', 'data-target' => '.navbar-ex1-collapse'))."\n";
+ echo EBootstrap::tag('span', array('class' => 'sr-only'), Yii::t('YiiBootstrap', 'Toggle Navigation'));
+ for ($i = 0; $i < 3; $i++) {
+ echo EBootstrap::tag('span', array('class' => 'icon-bar'))."\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();
+ EBootstrap::mergeClass($options, array('brand'));
+ echo EBootstrap::link($items[$i]['label'],$items[$i]['url'],$options)."\n";
+ unset($items[$i]);
+ break;
}
-
- echo EBootstrap::openTag('div', array('class' => 'nav-collapse'))."\n";
}
+ echo EBootstrap::closeTag('button')."\n";
+
+ echo EBootstrap::openTag('div', array('class' => 'collapse navbar-collapse navbar-ex1-collapse'))."\n";
$this->renderMenuRecursive($items);
- if ($this->responsive) {
- echo EBootstrap::closeTag('div')."\n";
- }
+ echo EBootstrap::closeTag('div')."\n";
echo EBootstrap::closeTag('div')."\n";
@@ -180,7 +179,7 @@ protected function renderMenuRecursive($items, $sub = false) {
break;
default:
- $listOptions = array('class' => 'nav');
+ $listOptions = array('class' => 'nav navbar-nav');
if (isset($item['align']) and ($item['align'] == 'right') and (isset($item['items']))) {
//Allign navigation right
Please sign in to comment.
Something went wrong with that request. Please try again.