From eb62390a05479c13ec77cba64bfc1446a68931d6 Mon Sep 17 00:00:00 2001 From: pana1990 Date: Wed, 20 May 2015 12:16:08 +0200 Subject: [PATCH 01/44] Add guide-es [skip ci] --- docs/guide-es/README.md | 27 +++++++++++++++++++++++++++ docs/guide-es/basic-usage.md | 16 ++++++++++++++++ docs/guide-es/installation.md | 20 ++++++++++++++++++++ docs/guide-es/topics-less.md | 17 +++++++++++++++++ docs/guide-es/usage-widgets.md | 20 ++++++++++++++++++++ 5 files changed, 100 insertions(+) create mode 100644 docs/guide-es/README.md create mode 100644 docs/guide-es/basic-usage.md create mode 100644 docs/guide-es/installation.md create mode 100644 docs/guide-es/topics-less.md create mode 100644 docs/guide-es/usage-widgets.md diff --git a/docs/guide-es/README.md b/docs/guide-es/README.md new file mode 100644 index 0000000..a04a317 --- /dev/null +++ b/docs/guide-es/README.md @@ -0,0 +1,27 @@ +Extensión Twitter Bootstrap para Yii 2 +====================================== + +La extensión incluye soporte para el marcado de [Bootstrap 3](http://getbootstrap.com/) y los componentes del framework +(también conocido como "Twitter Bootstrap"). Bootstrap es un excelente framework responsivo que puede acelerar +enormemente el proceso de desarrollo del lado del cliente. + +El núcleo de Boostrap está representado por dos partes: + +- Bases de CSS, tales como un sistema de cuadriculas, tipografía, clases de ayuda, y utilidades responsivas. +- Componentes listos para usar, tales como formularios, menús, paginación, cajas modales, tabs, etc. + +Pasos Iniciales +--------------- + +* [Instalación](installation.md) +* [Uso Básico](basic-usage.md) + +Uso +--- + +* [Yii widgets](usage-widgets.md) + +Topics Adicionales +------------------ + +* [Usando directamente los ficheros .less de Bootstrap](topics-less.md) diff --git a/docs/guide-es/basic-usage.md b/docs/guide-es/basic-usage.md new file mode 100644 index 0000000..0bd0c76 --- /dev/null +++ b/docs/guide-es/basic-usage.md @@ -0,0 +1,16 @@ +Uso Básico +========== + +Yii no se ajusta a los conceptos básicos de bootstrap dentro del código PHP, desde el HTML es muy simple en si mismo +en este caso. Puedes encontrar los detalles sobre el uso de los conceptos básicos en la [web de bootstrap](http://getbootstrap.com/css/).Yii proporciona una manera de incluir los assets de bootstrap en tus páginas añadiendo una única linea a `AppAsset.php` localizado en tu +directorio `@app/assets`: + +```php +public $depends = [ + 'yii\web\YiiAsset', + 'yii\bootstrap\BootstrapAsset', // esta linea +]; +``` + +Usando bootstrap a través de Yii asset manager permite que minimices los recursos y combinarlos con tus propios recursos +cuando lo necesites. diff --git a/docs/guide-es/installation.md b/docs/guide-es/installation.md new file mode 100644 index 0000000..13d8882 --- /dev/null +++ b/docs/guide-es/installation.md @@ -0,0 +1,20 @@ +Instalación +=========== + +## Obteniendo el Paquete de Composer + +La mejor manera para instalar esta extensión es a través de [composer](http://getcomposer.org/download/). + +Ejecuta + +``` +php composer.phar require --prefer-dist yiisoft/yii2-bootstrap +``` + +o añade + +``` +"yiisoft/yii2-bootstrap": "~2.0.0" +``` + +en la sección require de tu fichero `composer.json`. diff --git a/docs/guide-es/topics-less.md b/docs/guide-es/topics-less.md new file mode 100644 index 0000000..4806c0b --- /dev/null +++ b/docs/guide-es/topics-less.md @@ -0,0 +1,17 @@ +Usando directamente los ficheros .less de Bootstrap +=================================================== + +Si deseas incluir el [css de Bootstrap directamente en tus ficheros less](http://getbootstrap.com/getting-started/#customizing) puedes necesitar deshabilitar los ficheros css de bootstrap originales para ser cargados. +Puedes hacer esto mediante la configuración de la propiedad css de [[yii\bootstrap\BootstrapAsset|BootstrapAsset]] asignando +un array vacio. +Para esto necesitas configurar el `assetManager` [componente de aplicación](https://github.com/yiisoft/yii2/blob/master/docs/guide-es/structure-application-components.md) como a continuación: + +```php + 'assetManager' => [ + 'bundles' => [ + 'yii\bootstrap\BootstrapAsset' => [ + 'css' => [], + ] + ] + ] +``` diff --git a/docs/guide-es/usage-widgets.md b/docs/guide-es/usage-widgets.md new file mode 100644 index 0000000..92bd7d4 --- /dev/null +++ b/docs/guide-es/usage-widgets.md @@ -0,0 +1,20 @@ +Yii widgets +=========== + +La mayoría de los componentes de bootstrap son envueltos dentro de Yii widgets lo que permite una sintaxis +más robusta y poder integrarse con las características del framework. Todos los widgets pertenecen +al namespace `\yii\bootstrap`: + +- [[yii\bootstrap\ActiveForm|ActiveForm]] +- [[yii\bootstrap\Alert|Alert]] +- [[yii\bootstrap\Button|Button]] +- [[yii\bootstrap\ButtonDropdown|ButtonDropdown]] +- [[yii\bootstrap\ButtonGroup|ButtonGroup]] +- [[yii\bootstrap\Carousel|Carousel]] +- [[yii\bootstrap\Collapse|Collapse]] +- [[yii\bootstrap\Dropdown|Dropdown]] +- [[yii\bootstrap\Modal|Modal]] +- [[yii\bootstrap\Nav|Nav]] +- [[yii\bootstrap\NavBar|NavBar]] +- [[yii\bootstrap\Progress|Progress]] +- [[yii\bootstrap\Tabs|Tabs]] From 6b3b5ddd2fd7a28507535cb5042a58f94a87f58d Mon Sep 17 00:00:00 2001 From: Lucas Barros Date: Fri, 22 May 2015 16:31:40 -0300 Subject: [PATCH 02/44] improving translation improving translation --- docs/guide-pt-BR/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guide-pt-BR/README.md b/docs/guide-pt-BR/README.md index f48ce62..0ab343a 100644 --- a/docs/guide-pt-BR/README.md +++ b/docs/guide-pt-BR/README.md @@ -1,14 +1,14 @@ Extenção Twitter Bootstrap para Yii 2 ===================================== -A extensão inclui suporte para ao framework [Bootstrap 3](http://getbootstrap.com/) marcação e componentes +A extensão inclui suporte para marcação e componentes ao framework [Bootstrap 3](http://getbootstrap.com/) (também conhecido como "Bootstrap Twitter"). Bootstrap é um excelente framework ágil, que pode acelerar bastante o do lado do cliente do seu processo de desenvolvimento. O núcleo de bootstrap é representado por duas partes: - Noções básicas de estilo CSS, tais como um sistema de rede layout, tipografia, classes auxiliares, e os utilitários de resposta. -- Pronto para usar componentes, tais como formulários, menus, paginação, caixas de modais, guias, etc. +- Componentes prontos para usar, tais como formulários, menus, paginação, caixas de modais, guias, etc. Iniciando --------------- From fbc61ed138095a529238dcf20f399ddd1c623f97 Mon Sep 17 00:00:00 2001 From: pana1990 Date: Mon, 25 May 2015 13:48:11 +0200 Subject: [PATCH 03/44] Update guide-es [skip ci] --- docs/guide-es/README.md | 4 ++-- docs/guide-es/basic-usage.md | 2 +- docs/guide-es/topics-less.md | 2 +- docs/guide-es/usage-widgets.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/guide-es/README.md b/docs/guide-es/README.md index a04a317..b22720c 100644 --- a/docs/guide-es/README.md +++ b/docs/guide-es/README.md @@ -21,7 +21,7 @@ Uso * [Yii widgets](usage-widgets.md) -Topics Adicionales ------------------- +Temas Adicionales +----------------- * [Usando directamente los ficheros .less de Bootstrap](topics-less.md) diff --git a/docs/guide-es/basic-usage.md b/docs/guide-es/basic-usage.md index 0bd0c76..05bc862 100644 --- a/docs/guide-es/basic-usage.md +++ b/docs/guide-es/basic-usage.md @@ -2,7 +2,7 @@ Uso Básico ========== Yii no se ajusta a los conceptos básicos de bootstrap dentro del código PHP, desde el HTML es muy simple en si mismo -en este caso. Puedes encontrar los detalles sobre el uso de los conceptos básicos en la [web de bootstrap](http://getbootstrap.com/css/).Yii proporciona una manera de incluir los assets de bootstrap en tus páginas añadiendo una única linea a `AppAsset.php` localizado en tu +en este caso. Puedes encontrar los detalles sobre el uso de los conceptos básicos en la [web de bootstrap](http://getbootstrap.com/css/). Yii proporciona una manera de incluir los assets de bootstrap en tus páginas añadiendo una única linea a `AppAsset.php` localizado en tu directorio `@app/assets`: ```php diff --git a/docs/guide-es/topics-less.md b/docs/guide-es/topics-less.md index 4806c0b..910f9a7 100644 --- a/docs/guide-es/topics-less.md +++ b/docs/guide-es/topics-less.md @@ -4,7 +4,7 @@ Usando directamente los ficheros .less de Bootstrap Si deseas incluir el [css de Bootstrap directamente en tus ficheros less](http://getbootstrap.com/getting-started/#customizing) puedes necesitar deshabilitar los ficheros css de bootstrap originales para ser cargados. Puedes hacer esto mediante la configuración de la propiedad css de [[yii\bootstrap\BootstrapAsset|BootstrapAsset]] asignando un array vacio. -Para esto necesitas configurar el `assetManager` [componente de aplicación](https://github.com/yiisoft/yii2/blob/master/docs/guide-es/structure-application-components.md) como a continuación: +Para esto necesitas configurar el `assetManager` [componente de aplicación](https://github.com/yiisoft/yii2/blob/master/docs/guide-es/structure-application-components.md) como se muestra a continuación: ```php 'assetManager' => [ diff --git a/docs/guide-es/usage-widgets.md b/docs/guide-es/usage-widgets.md index 92bd7d4..1605829 100644 --- a/docs/guide-es/usage-widgets.md +++ b/docs/guide-es/usage-widgets.md @@ -1,7 +1,7 @@ Yii widgets =========== -La mayoría de los componentes de bootstrap son envueltos dentro de Yii widgets lo que permite una sintaxis +La mayoría de los componentes de bootstrap están encapsulados dentro de Yii widgets lo que permite una sintaxis más robusta y poder integrarse con las características del framework. Todos los widgets pertenecen al namespace `\yii\bootstrap`: From 05253b8fd6d36ba23292eac65e573d1b1f54b0ec Mon Sep 17 00:00:00 2001 From: Francesc Bautista Date: Mon, 25 May 2015 23:59:26 +0200 Subject: [PATCH 04/44] Enh #50: Added `dropDownOptions` that is passed to `yii\bootstrap\Nav` dropdown items --- CHANGELOG.md | 1 + Nav.php | 2 ++ tests/NavTest.php | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fc21df..400739c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Yii Framework 2 bootstrap extension Change Log - Enh #42: Added support for the glyphicons via `yii\bootstrap\Html::icon()` (klimov-paul) - Enh #43: Added support for the static form controls via `yii\bootstrap\Html` (klimov-paul) - Enh #44: Fixed `yii\bootstrap\ButtonDropdown` renders two buttons have same with id if 'split' is enabled (klimov-paul) +- Enh #50: Added `dropDownOptions` that is passed to `yii\bootstrap\Nav` dropdown items (fbau123) 2.0.4 May 10, 2015 diff --git a/Nav.php b/Nav.php index 0e8e0ac..5be7994 100644 --- a/Nav.php +++ b/Nav.php @@ -63,6 +63,7 @@ class Nav extends Widget * - linkOptions: array, optional, the HTML attributes of the item's link. * - options: array, optional, the HTML attributes of the item container (LI). * - active: boolean, optional, whether the item should be on active state or not. + * - dropDownOptions: array, optional, the HTML options that will passed to the [[Dropdown]] widget. * - items: array|string, optional, the configuration array for creating a [[Dropdown]] widget, * or a string representing the dropdown menu. Note that Bootstrap does not support sub-dropdown menus. * @@ -208,6 +209,7 @@ class Nav extends Widget protected function renderDropdown($items, $parentItem) { return Dropdown::widget([ + 'options' => ArrayHelper::getValue($parentItem, 'dropDownOptions', []), 'items' => $items, 'encodeLabels' => $this->encodeLabels, 'clientOptions' => false, diff --git a/tests/NavTest.php b/tests/NavTest.php index 3fad720..3510af4 100644 --- a/tests/NavTest.php +++ b/tests/NavTest.php @@ -47,4 +47,43 @@ EXPECTED; $this->assertEqualsWithoutLE($expected, $out); } + + public function testRenderDropDownWithDropDownOptions() + { + Nav::$counter = 0; + $out = Nav::widget( + [ + 'items' => [ + [ + 'label' => 'Page1', + 'content' => 'Page1', + ], + [ + 'label' => 'Dropdown1', + 'dropDownOptions' => ['class' => 'test', 'data-id' => 't1', 'id' => 'test1'], + 'items' => [ + ['label' => 'Page2', 'content' => 'Page2'], + ['label' => 'Page3', 'content' => 'Page3'], + ] + ], + [ + 'label' => 'Dropdown2', + 'visible' => false, + 'items' => [ + ['label' => 'Page4', 'content' => 'Page4'], + ['label' => 'Page5', 'content' => 'Page5'], + ] + ] + ] + ] + ); + + $expected = <<
  • Page1
  • + +EXPECTED; + + $this->assertEqualsWithoutLE($expected, $out); + } } From 3ec5987344162a13f7041b155fd82e5797117f8d Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Wed, 27 May 2015 14:20:28 +0300 Subject: [PATCH 05/44] Allow override CSS classes added by widgets --- Alert.php | 4 +--- Button.php | 2 +- ButtonDropdown.php | 8 ++++---- ButtonGroup.php | 2 +- Carousel.php | 4 ++-- Collapse.php | 6 +++--- Dropdown.php | 6 +++--- Modal.php | 6 +++--- Nav.php | 6 +++--- NavBar.php | 13 ++++++------- Progress.php | 4 ++-- Tabs.php | 10 +++++----- docs/guide/usage-widgets.md | 37 +++++++++++++++++++++++++++++++++++++ 13 files changed, 71 insertions(+), 37 deletions(-) diff --git a/Alert.php b/Alert.php index e5755c1..18f3960 100644 --- a/Alert.php +++ b/Alert.php @@ -135,9 +135,7 @@ class Alert extends Widget */ protected function initOptions() { - Html::addCssClass($this->options, 'alert'); - Html::addCssClass($this->options, 'fade'); - Html::addCssClass($this->options, 'in'); + Html::addCssClass($this->options, ['alert', 'fade', 'in']); if ($this->closeButton !== false) { $this->closeButton = array_merge([ diff --git a/Button.php b/Button.php index eedcc46..985279a 100644 --- a/Button.php +++ b/Button.php @@ -46,7 +46,7 @@ class Button extends Widget { parent::init(); $this->clientOptions = false; - Html::addCssClass($this->options, 'btn'); + Html::addCssClass($this->options, ['widget' => 'btn']); } /** diff --git a/ButtonDropdown.php b/ButtonDropdown.php index 0d10b6f..1a379d7 100644 --- a/ButtonDropdown.php +++ b/ButtonDropdown.php @@ -75,7 +75,7 @@ class ButtonDropdown extends Widget public function run() { // @todo use [[options]] instead of [[containerOptions]] and introduce [[buttonOptions]] before 2.1 release - Html::addCssClass($this->containerOptions, 'btn-group'); + Html::addCssClass($this->containerOptions, ['widget' => 'btn-group']); $options = $this->containerOptions; $tag = ArrayHelper::remove($options, 'tag', 'div'); @@ -94,7 +94,7 @@ class ButtonDropdown extends Widget */ protected function renderButton() { - Html::addCssClass($this->options, 'btn'); + Html::addCssClass($this->options, ['widget' => 'btn']); $label = $this->label; if ($this->encodeLabel) { $label = Html::encode($label); @@ -102,7 +102,7 @@ class ButtonDropdown extends Widget if ($this->split) { $options = $this->options; $this->options['data-toggle'] = 'dropdown'; - Html::addCssClass($this->options, 'dropdown-toggle'); + Html::addCssClass($this->options, ['toggle' => 'dropdown-toggle']); unset($this->options['id']); $splitButton = Button::widget([ 'label' => '', @@ -116,7 +116,7 @@ class ButtonDropdown extends Widget if (!isset($options['href'])) { $options['href'] = '#'; } - Html::addCssClass($options, 'dropdown-toggle'); + Html::addCssClass($options, ['toggle' => 'dropdown-toggle']); $options['data-toggle'] = 'dropdown'; $splitButton = ''; } diff --git a/ButtonGroup.php b/ButtonGroup.php index 4bf47ef..a0c3ec2 100644 --- a/ButtonGroup.php +++ b/ButtonGroup.php @@ -65,7 +65,7 @@ class ButtonGroup extends Widget public function init() { parent::init(); - Html::addCssClass($this->options, 'btn-group'); + Html::addCssClass($this->options, ['widget' => 'btn-group']); } /** diff --git a/Carousel.php b/Carousel.php index f212619..d932a66 100644 --- a/Carousel.php +++ b/Carousel.php @@ -72,7 +72,7 @@ class Carousel extends Widget public function init() { parent::init(); - Html::addCssClass($this->options, 'carousel'); + Html::addCssClass($this->options, ['widget' => 'carousel']); } /** @@ -149,7 +149,7 @@ class Carousel extends Widget throw new InvalidConfigException('The "content" option is required.'); } - Html::addCssClass($options, 'item'); + Html::addCssClass($options, ['widget' => 'item']); if ($index === 0) { Html::addCssClass($options, 'active'); } diff --git a/Collapse.php b/Collapse.php index 0b33cd5..b2de61f 100644 --- a/Collapse.php +++ b/Collapse.php @@ -78,7 +78,7 @@ class Collapse extends Widget public function init() { parent::init(); - Html::addCssClass($this->options, 'panel-group'); + Html::addCssClass($this->options, ['widget' => 'panel-group']); } /** @@ -109,7 +109,7 @@ class Collapse extends Widget } $header = $item['label']; $options = ArrayHelper::getValue($item, 'options', []); - Html::addCssClass($options, 'panel panel-default'); + Html::addCssClass($options, ['panel' => 'panel', 'widget' => 'panel-default']); $items[] = Html::tag('div', $this->renderItem($header, $item, ++$index), $options); } @@ -130,7 +130,7 @@ class Collapse extends Widget $id = $this->options['id'] . '-collapse' . $index; $options = ArrayHelper::getValue($item, 'contentOptions', []); $options['id'] = $id; - Html::addCssClass($options, 'panel-collapse collapse'); + Html::addCssClass($options, ['widget' => 'panel-collapse', 'collapse' => 'collapse']); $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels; if ($encodeLabel) { diff --git a/Dropdown.php b/Dropdown.php index 1c28f01..b68ac11 100644 --- a/Dropdown.php +++ b/Dropdown.php @@ -77,7 +77,7 @@ class Dropdown extends Widget unset($this->submenuOptions['id']); } parent::init(); - Html::addCssClass($this->options, 'dropdown-menu'); + Html::addCssClass($this->options, ['widget' => 'dropdown-menu']); } /** @@ -120,7 +120,7 @@ class Dropdown extends Widget if (empty($item['items'])) { if ($url === null) { $content = $label; - Html::addCssClass($itemOptions, 'dropdown-header'); + Html::addCssClass($itemOptions, ['widget' => 'dropdown-header']); } else { $content = Html::a($label, $url, $linkOptions); } @@ -131,7 +131,7 @@ class Dropdown extends Widget } $content = Html::a($label, $url === null ? '#' : $url, $linkOptions) . $this->renderItems($item['items'], $submenuOptions); - Html::addCssClass($itemOptions, 'dropdown-submenu'); + Html::addCssClass($itemOptions, ['widget' => 'dropdown-submenu']); } $lines[] = Html::tag('li', $content, $itemOptions); diff --git a/Modal.php b/Modal.php index c138f30..6555135 100644 --- a/Modal.php +++ b/Modal.php @@ -136,7 +136,7 @@ class Modal extends Widget $this->header = $button . "\n" . $this->header; } if ($this->header !== null) { - Html::addCssClass($this->headerOptions, 'modal-header'); + Html::addCssClass($this->headerOptions, ['widget' => 'modal-header']); return Html::tag('div', "\n" . $this->header . "\n", $this->headerOptions); } else { return null; @@ -168,7 +168,7 @@ class Modal extends Widget protected function renderFooter() { if ($this->footer !== null) { - Html::addCssClass($this->footerOptions, 'modal-footer'); + Html::addCssClass($this->footerOptions, ['widget' => 'modal-footer']); return Html::tag('div', "\n" . $this->footer . "\n", $this->footerOptions); } else { return null; @@ -224,7 +224,7 @@ class Modal extends Widget 'role' => 'dialog', 'tabindex' => -1, ], $this->options); - Html::addCssClass($this->options, 'modal'); + Html::addCssClass($this->options, ['widget' => 'modal']); if ($this->clientOptions !== false) { $this->clientOptions = array_merge(['show' => false], $this->clientOptions); diff --git a/Nav.php b/Nav.php index 5be7994..d59e9b0 100644 --- a/Nav.php +++ b/Nav.php @@ -121,7 +121,7 @@ class Nav extends Widget if ($this->dropDownCaret === null) { $this->dropDownCaret = Html::tag('b', '', ['class' => 'caret']); } - Html::addCssClass($this->options, 'nav'); + Html::addCssClass($this->options, ['widget' => 'nav']); } /** @@ -178,8 +178,8 @@ class Nav extends Widget if ($items !== null) { $linkOptions['data-toggle'] = 'dropdown'; - Html::addCssClass($options, 'dropdown'); - Html::addCssClass($linkOptions, 'dropdown-toggle'); + Html::addCssClass($options, ['widget' => 'dropdown']); + Html::addCssClass($linkOptions, ['widget' => 'dropdown-toggle']); if ($this->dropDownCaret !== '') { $label .= ' ' . $this->dropDownCaret; } diff --git a/NavBar.php b/NavBar.php index aa6db21..f67f32b 100644 --- a/NavBar.php +++ b/NavBar.php @@ -93,11 +93,11 @@ class NavBar extends Widget { parent::init(); $this->clientOptions = false; - Html::addCssClass($this->options, 'navbar'); - if ($this->options['class'] === 'navbar') { - Html::addCssClass($this->options, 'navbar-default'); + if (empty($this->options['class'])) { + Html::addCssClass($this->options, ['navbar', 'navbar-default']); + } else { + Html::addCssClass($this->options, ['widget' => 'navbar']); } - Html::addCssClass($this->brandOptions, 'navbar-brand'); if (empty($this->options['role'])) { $this->options['role'] = 'navigation'; } @@ -116,12 +116,11 @@ class NavBar extends Widget } echo $this->renderToggleButton(); if ($this->brandLabel !== false) { - Html::addCssClass($this->brandOptions, 'navbar-brand'); + Html::addCssClass($this->brandOptions, ['widget' => 'navbar-brand']); echo Html::a($this->brandLabel, $this->brandUrl === false ? Yii::$app->homeUrl : $this->brandUrl, $this->brandOptions); } echo Html::endTag('div'); - Html::addCssClass($this->containerOptions, 'collapse'); - Html::addCssClass($this->containerOptions, 'navbar-collapse'); + Html::addCssClass($this->containerOptions, ['collapse' => 'collapse', 'widget' => 'navbar-collapse']); $options = $this->containerOptions; $tag = ArrayHelper::remove($options, 'tag', 'div'); echo Html::beginTag($tag, $options); diff --git a/Progress.php b/Progress.php index d80bd6b..14c7122 100644 --- a/Progress.php +++ b/Progress.php @@ -96,7 +96,7 @@ class Progress extends Widget public function init() { parent::init(); - Html::addCssClass($this->options, 'progress'); + Html::addCssClass($this->options, ['widget' => 'progress']); } /** @@ -152,7 +152,7 @@ class Progress extends Widget 'style' => "width:{$percent}%", ]; $options = array_merge($defaultOptions, $options); - Html::addCssClass($options, 'progress-bar'); + Html::addCssClass($options, ['widget' => 'progress-bar']); $out = Html::beginTag('div', $options); $out .= $label; diff --git a/Tabs.php b/Tabs.php index ff5293a..f60724f 100644 --- a/Tabs.php +++ b/Tabs.php @@ -122,7 +122,7 @@ class Tabs extends Widget public function init() { parent::init(); - Html::addCssClass($this->options, 'nav ' . $this->navType); + Html::addCssClass($this->options, ['widget' => 'nav', $this->navType]); } /** @@ -162,13 +162,13 @@ class Tabs extends Widget if (isset($item['items'])) { $label .= ' '; - Html::addCssClass($headerOptions, 'dropdown'); + Html::addCssClass($headerOptions, ['widget' => 'dropdown']); if ($this->renderDropdown($n, $item['items'], $panes)) { Html::addCssClass($headerOptions, 'active'); } - Html::addCssClass($linkOptions, 'dropdown-toggle'); + Html::addCssClass($linkOptions, ['widget' => 'dropdown-toggle']); $linkOptions['data-toggle'] = 'dropdown'; $header = Html::a($label, "#", $linkOptions) . "\n" . Dropdown::widget(['items' => $item['items'], 'clientOptions' => false, 'view' => $this->getView()]); @@ -176,7 +176,7 @@ class Tabs extends Widget $options = array_merge($this->itemOptions, ArrayHelper::getValue($item, 'options', [])); $options['id'] = ArrayHelper::getValue($options, 'id', $this->options['id'] . '-tab' . $n); - Html::addCssClass($options, 'tab-pane'); + Html::addCssClass($options, ['widget' => 'tab-pane']); if (ArrayHelper::remove($item, 'active')) { Html::addCssClass($options, 'active'); Html::addCssClass($headerOptions, 'active'); @@ -241,7 +241,7 @@ class Tabs extends Widget $content = ArrayHelper::remove($item, 'content'); $options = ArrayHelper::remove($item, 'contentOptions', []); - Html::addCssClass($options, 'tab-pane'); + Html::addCssClass($options, ['widget' => 'tab-pane']); if (ArrayHelper::remove($item, 'active')) { Html::addCssClass($options, 'active'); Html::addCssClass($item['options'], 'active'); diff --git a/docs/guide/usage-widgets.md b/docs/guide/usage-widgets.md index 004a949..6b63e72 100644 --- a/docs/guide/usage-widgets.md +++ b/docs/guide/usage-widgets.md @@ -17,3 +17,40 @@ framework features. All widgets belong to `\yii\bootstrap` namespace: - [[yii\bootstrap\NavBar|NavBar]] - [[yii\bootstrap\Progress|Progress]] - [[yii\bootstrap\Tabs|Tabs]] + + +## Customize widget CSS classes + +Widgets allow quick composition of the HTML for particular Bootstrap components, which requires usage of the +Bootstrap CSS classes. Those classes are added automatically by the widgets. However usually widget provides +fields or properties, which allow customization of the CSS styles for particular HTML tags. + +For example: you may use [[yii\bootstrap\Button::options]] to customize appearance of the rendered button. +Class 'btn' will be added automatically, so you don't need to worry about it. All you need is specify particular +button class: + +```php +echo Button::widget([ + 'label' => 'Action', + 'options' => ['class' => 'btn-primary'], // produces class "btn btn-primary" +]); +``` + +However, sometimes you may need to replace standard class, added by the widget, with alternative one. +For example: widget [[yii\bootstrap\ButtonGroup]] uses 'btn-group' class for the container div, but you may +need to use 'btn-group-vertical', which allows vertical-style layout for the buttons. Using plain 'class' option +simply adds 'btn-group-vertical' to 'btn-group', which produces incorrect result. +In order to actually replace class added by widget, you need to specify 'class' option as array, containing +needed class name under the 'widget' key: + +```php +echo ButtonGroup::widget([ + 'options' => [ + 'class' => ['widget' => 'btn-group-vertical'] // replace 'btn-group' with 'btn-group-vertical' + ], + 'buttons' => [ + ['label' => 'A'], + ['label' => 'B'], + ] +]); +``` From c7e5c313716ef2dd1e1e82bb9a87235ad4f08264 Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Wed, 27 May 2015 16:10:26 +0300 Subject: [PATCH 06/44] 'yiisoft/yii2' package dependency changed --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b3ff507..3818768 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "yiisoft/yii2": ">=2.0.4", + "yiisoft/yii2": "*", "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*" }, "autoload": { From 548e7c7e4cb3445e6f6692c2017de1023ea12bcb Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Thu, 28 May 2015 14:29:08 +0300 Subject: [PATCH 07/44] 'yiisoft/yii2' package dependency version switched to 'dev' --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3818768..87b1212 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "yiisoft/yii2": "*", + "yiisoft/yii2": ">=2.0.x-dev", "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*" }, "autoload": { From 81ccca3ada49fe9068d495e0395681c013b41eee Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Thu, 28 May 2015 14:35:16 +0300 Subject: [PATCH 08/44] issue #15 added to CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 400739c..905e5e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Yii Framework 2 bootstrap extension Change Log 2.0.5 under development ----------------------- +- Enh #15: Allowed overriding default Bootstrap CSS classes added by widgets (klimov-paul) - Enh #38: Added object support for `content` option in `Collapse` class (pana1990, ItsReddi) - Enh #40: Added `visible` option to `yii\bootstrap\Tab` widget items (klimov-paul) - Enh #41: Added `submenuOptions` support at `yii\bootstrap\Dropdown` (spikyjt, klimov-paul) From 202d7bfdfb73e516f404f5d501c6c2cbc010f11d Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Thu, 28 May 2015 14:52:21 +0300 Subject: [PATCH 09/44] Fix issue description at CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 905e5e1..00285ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ Yii Framework 2 bootstrap extension Change Log - Enh #41: Added `submenuOptions` support at `yii\bootstrap\Dropdown` (spikyjt, klimov-paul) - Enh #42: Added support for the glyphicons via `yii\bootstrap\Html::icon()` (klimov-paul) - Enh #43: Added support for the static form controls via `yii\bootstrap\Html` (klimov-paul) -- Enh #44: Fixed `yii\bootstrap\ButtonDropdown` renders two buttons have same with id if 'split' is enabled (klimov-paul) +- Enh #44: Fixed `yii\bootstrap\ButtonDropdown` renders two buttons with the same id, if 'split' is enabled (klimov-paul) - Enh #50: Added `dropDownOptions` that is passed to `yii\bootstrap\Nav` dropdown items (fbau123) From 3a943df1579505430e42ec05a986c5bb508cdc7d Mon Sep 17 00:00:00 2001 From: Nobuo Kihara Date: Fri, 29 May 2015 00:19:04 +0900 Subject: [PATCH 10/44] docs/guide/usage-widgets.md revised for readability [ci skip] --- docs/guide/usage-widgets.md | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/guide/usage-widgets.md b/docs/guide/usage-widgets.md index 6b63e72..ac3aef1 100644 --- a/docs/guide/usage-widgets.md +++ b/docs/guide/usage-widgets.md @@ -19,15 +19,14 @@ framework features. All widgets belong to `\yii\bootstrap` namespace: - [[yii\bootstrap\Tabs|Tabs]] -## Customize widget CSS classes +## Customizing widget CSS classes -Widgets allow quick composition of the HTML for particular Bootstrap components, which requires usage of the -Bootstrap CSS classes. Those classes are added automatically by the widgets. However usually widget provides -fields or properties, which allow customization of the CSS styles for particular HTML tags. +These widgets allow quick composition of the HTML for the Bootstrap components that require the use of the Bootstrap CSS classes. +The default class for the component is added automatically by the widget, and the optional classes that you may want to customize are usually supported through the properties of the widget. -For example: you may use [[yii\bootstrap\Button::options]] to customize appearance of the rendered button. -Class 'btn' will be added automatically, so you don't need to worry about it. All you need is specify particular -button class: +For example, you may use [[yii\bootstrap\Button::options]] to customize the appearance of a button. +The class 'btn' which is required for a button will be added automatically, so you don't need to worry about it. +All you need is specify a particular button class: ```php echo Button::widget([ @@ -36,17 +35,16 @@ echo Button::widget([ ]); ``` -However, sometimes you may need to replace standard class, added by the widget, with alternative one. -For example: widget [[yii\bootstrap\ButtonGroup]] uses 'btn-group' class for the container div, but you may -need to use 'btn-group-vertical', which allows vertical-style layout for the buttons. Using plain 'class' option -simply adds 'btn-group-vertical' to 'btn-group', which produces incorrect result. -In order to actually replace class added by widget, you need to specify 'class' option as array, containing -needed class name under the 'widget' key: +However, sometimes you may need to replace the default class with an alternative one. +For example, the widget [[yii\bootstrap\ButtonGroup]] uses 'btn-group' class for the container div by default, +but you may need to use 'btn-group-vertical' instead to align the buttons vertically. +Using a plain 'class' option simply adds 'btn-group-vertical' to 'btn-group', which will produce an incorrect result. +In order to override the default class of a widget, you need to specify the 'class' option as an array that contains the customized class name under the 'widget' key: ```php echo ButtonGroup::widget([ 'options' => [ - 'class' => ['widget' => 'btn-group-vertical'] // replace 'btn-group' with 'btn-group-vertical' + 'class' => ['widget' => 'btn-group-vertical'] // replaces 'btn-group' with 'btn-group-vertical' ], 'buttons' => [ ['label' => 'A'], From b945f9ea3d80e445eb52fd0192abcbfa7c7c8eb0 Mon Sep 17 00:00:00 2001 From: Nobuo Kihara Date: Fri, 29 May 2015 07:28:49 +0900 Subject: [PATCH 11/44] docs/guide/usage-widgets.md - updated [ci skip] --- docs/guide/usage-widgets.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/guide/usage-widgets.md b/docs/guide/usage-widgets.md index ac3aef1..8adcfec 100644 --- a/docs/guide/usage-widgets.md +++ b/docs/guide/usage-widgets.md @@ -21,8 +21,8 @@ framework features. All widgets belong to `\yii\bootstrap` namespace: ## Customizing widget CSS classes -These widgets allow quick composition of the HTML for the Bootstrap components that require the use of the Bootstrap CSS classes. -The default class for the component is added automatically by the widget, and the optional classes that you may want to customize are usually supported through the properties of the widget. +The widgets allow quick composition of the HTML for the bootstrap components that require the bootstrap CSS classes. +The default classes for a particular component will be added automatically by the widget, and the optional classes that you may want to customize are usually supported through the properties of the widget. For example, you may use [[yii\bootstrap\Button::options]] to customize the appearance of a button. The class 'btn' which is required for a button will be added automatically, so you don't need to worry about it. @@ -35,11 +35,11 @@ echo Button::widget([ ]); ``` -However, sometimes you may need to replace the default class with an alternative one. +However, sometimes you may need to replace the default classes with the alternative ones. For example, the widget [[yii\bootstrap\ButtonGroup]] uses 'btn-group' class for the container div by default, but you may need to use 'btn-group-vertical' instead to align the buttons vertically. Using a plain 'class' option simply adds 'btn-group-vertical' to 'btn-group', which will produce an incorrect result. -In order to override the default class of a widget, you need to specify the 'class' option as an array that contains the customized class name under the 'widget' key: +In order to override the default classes of a widget, you need to specify the 'class' option as an array that contains the customized class definition under the 'widget' key: ```php echo ButtonGroup::widget([ From 9a7e19647774be757d86df108c5c6c2790a6ca9f Mon Sep 17 00:00:00 2001 From: Nobuo Kihara Date: Fri, 29 May 2015 18:41:33 +0900 Subject: [PATCH 12/44] docs/guide-ja/usage-widgets.md updated [ci skip] --- docs/guide-ja/usage-widgets.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/docs/guide-ja/usage-widgets.md b/docs/guide-ja/usage-widgets.md index 1817349..d74ca56 100644 --- a/docs/guide-ja/usage-widgets.md +++ b/docs/guide-ja/usage-widgets.md @@ -17,3 +17,38 @@ Yii ウィジェット - [[yii\bootstrap\NavBar|NavBar]] - [[yii\bootstrap\Progress|Progress]] - [[yii\bootstrap\Tabs|Tabs]] + + +## ウィジェットの CSS クラスをカスタマイズする + +これらのウィジェットを使うと、bootstrap CSS クラスの使用を要求する bootstrap コンポーネントのための HTML を素速く構成することが出来ます。 +特定のコンポーネントのデフォルトの CSS クラスはウィジェットによって自動的に追加されます。 +そして、あなたがカスタマイズしたいであろうオプションの CSS クラスは、通常は、ウィジェットのプロパティによってサポートされています。 + +例えば、[[yii\bootstrap\Button::options]] を使って、ボタンの外見をカスタマイズすることが出来ます。 +このとき、ボタンに要求される 'btn' クラスは自動的に追加されますので、あなたが心配をする必要はありません。 +特定のボタンクラスを指定するだけで十分です。 + +```php +echo Button::widget([ + 'label' => 'Action', + 'options' => ['class' => 'btn-primary'], // "btn btn-primary" というクラスを生成 +]); +``` + +しかしながら、時として、デフォルトのクラスを別のクラスで置き換える必要がある場合があります。 +例えば、[[yii\bootstrap\ButtonGroup]] は、コンテナの div に 'btn-group' をデフォルトで使用しますが、ボタンを垂直に並べるために 'btn-group-vertical' を代りに使いたいことがあるでしょう。 +単純に 'class' オプションを使うと、'btn-group-vertical' が 'btn-group' に追加されるだけで、正しくない結果が生成されることになります。 +ウィジェットのデフォルトのクラスをオーバーライドするためには、'class' オプションに配列形式を使用して、'widget' キーの下にカスタマイズしたクラスの定義を指定しなければなりません。 + +```php +echo ButtonGroup::widget([ + 'options' => [ + 'class' => ['widget' => 'btn-group-vertical'] // 'btn-group' を 'btn-group-vertical' で置き換え + ], + 'buttons' => [ + ['label' => 'A'], + ['label' => 'B'], + ] +]); +``` From f90a610e1a531d1b8057215ffc69e891f136f414 Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Fri, 29 May 2015 14:28:09 +0300 Subject: [PATCH 13/44] Docs about `yii\bootstrap\Html` added --- Html.php | 2 +- docs/guide/README.md | 1 + docs/guide/helper-html.md | 30 ++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 docs/guide/helper-html.md diff --git a/Html.php b/Html.php index a2c87e6..95f2e25 100644 --- a/Html.php +++ b/Html.php @@ -8,7 +8,7 @@ namespace yii\bootstrap; /** - * Html is an enhanced version of [[\yii\helpers\Html]] helper class dedicated to Bootstrap needs. + * Html is an enhanced version of [[\yii\helpers\Html]] helper class dedicated to the Bootstrap needs. * This class inherits all functionality available at [[\yii\helpers\Html]] and can be used as substitute. * * Attention: do not confuse [[\yii\bootstrap\Html]] and [[\yii\helpers\Html]], be careful in which class diff --git a/docs/guide/README.md b/docs/guide/README.md index b6b25a2..ba5bebe 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -20,6 +20,7 @@ Usage ----- * [Yii widgets](usage-widgets.md) +* [Html helper](helper-html.md) Additional topics ----------------- diff --git a/docs/guide/helper-html.md b/docs/guide/helper-html.md new file mode 100644 index 0000000..cd8d116 --- /dev/null +++ b/docs/guide/helper-html.md @@ -0,0 +1,30 @@ +Html helper +=========== + +Bootstrap introduces many consistent HTML constructions and skeletons, which allow creating different visual effects. +Only the most complex of them are covered by widgets provided with this extension. The rest should be composed manually +using direct HTML composition. +However, several special Bootstrap markup cases are covered by [[\yii\bootstrap\Html]] helper. +[[\yii\bootstrap\Html]] is an enhanced version of the regular [[\yii\helpers\Html]] dedicated to the Bootstrap needs. +It provides several useful methods: + + - `icon()` - allows rendering of Glyphicon icons + - `staticControl()` - allows rendering of form "static controls" + +[[\yii\bootstrap\Html]] inherits all functionality available at [[\yii\helpers\Html]] and can be used as substitute, +so you don't need them both inside your view files. +For example: + +```php + + Html::icon('approve') . Html::encode('Save & apply'), + 'encodeLabel' => false, + 'options' => ['class' => 'btn-primary'], +]); ?> +``` + +> Attention: do not confuse [[\yii\bootstrap\Html]] and [[\yii\helpers\Html]], be careful in which class + you are using inside your views. \ No newline at end of file From 22b962fb898be4471eb91853a0f5f7601643c58f Mon Sep 17 00:00:00 2001 From: pana1990 Date: Fri, 29 May 2015 14:03:29 +0200 Subject: [PATCH 14/44] Update guide-es [skip ci] --- docs/guide-es/usage-widgets.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/guide-es/usage-widgets.md b/docs/guide-es/usage-widgets.md index 1605829..75189b2 100644 --- a/docs/guide-es/usage-widgets.md +++ b/docs/guide-es/usage-widgets.md @@ -18,3 +18,41 @@ al namespace `\yii\bootstrap`: - [[yii\bootstrap\NavBar|NavBar]] - [[yii\bootstrap\Progress|Progress]] - [[yii\bootstrap\Tabs|Tabs]] + + +## Personalización de las clases css para los widget + +Los widgets permiten una rápida composición del HTML para los componentes de bootstrap que requieren las clases +CSS de bootstrap. +Las clases por defecto para un componente en particular serán añadidas automáticamente por los widgets, y las clases +opcionales que quieres personalizar son frecuentemente soportadas a través de las propiedades de los widgets. + +Por ejemplo, puedas usar [[yii\bootstrap\Button::options]] para personalizar la apariencia de un botón. +La clase 'btn' que se requiere para un botón será añadida automáticamente, por lo que no necesitas preocuparte +por ello. +Todo lo que necesitas es especificar una clase de botón en particular: + +```php +echo Button::widget([ + 'label' => 'Action', + 'options' => ['class' => 'btn-primary'], // produce la clase "btn btn-primary" +]); +``` + +Sin embargo, a veces puede que tengas que remplazar las clases por defecto por las alternativas. +Por ejemplo, el widget [[yii\bootstrap\ButtonGroup]] utiliza por defecto la clase 'btn-group' para el contenido del div, pero necesitas usar 'btn-group-vertical' en lugar de alinear los botones verticalmente. +El uso directo de la opción 'class' simplemente añade 'btn-group-vertical' a 'btn-group, el cual producirá un resultado incorrecto. +Con el fin de sobrescribir las clases por defecto de un widget, necesitas especificar la opción 'class' como un +array que contiene la definición de la clase personalizada bajo la clave 'widget': + +```php +echo ButtonGroup::widget([ + 'options' => [ + 'class' => ['widget' => 'btn-group-vertical'] // remplaza 'btn-group' con 'btn-group-vertical' + ], + 'buttons' => [ + ['label' => 'A'], + ['label' => 'B'], + ] +]); +``` From 2c4ed78a7caceba585f46f08de739f7b97010b03 Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Fri, 29 May 2015 17:14:40 +0300 Subject: [PATCH 15/44] 'Asset Bundles' topic added to the docs. --- docs/guide/README.md | 1 + docs/guide/asset-bundles.md | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 docs/guide/asset-bundles.md diff --git a/docs/guide/README.md b/docs/guide/README.md index ba5bebe..db62c99 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -21,6 +21,7 @@ Usage * [Yii widgets](usage-widgets.md) * [Html helper](helper-html.md) +* [Asset Bundles](asset-bundles.md) Additional topics ----------------- diff --git a/docs/guide/asset-bundles.md b/docs/guide/asset-bundles.md new file mode 100644 index 0000000..d6cd382 --- /dev/null +++ b/docs/guide/asset-bundles.md @@ -0,0 +1,16 @@ +Asset Bundles +============= + +Bootstrap is a complex front-end solution, which includes CSS, JavaScript, fonts and so on. +In order to allow you most flexible control over Bootstrap components, this extension provides several asset bundles. +They are: + +- [[yii\bootstrap\BootstrapAsset|BootstrapAsset]] - contains only main CSS files. +- [[yii\bootstrap\BootstrapPluginAsset|BootstrapPluginAsset]] - depends on [[yii\bootstrap\BootstrapAsset]], contains javascript files. +- [[yii\bootstrap\BootstrapThemeAsset|BootstrapThemeAsset]] - depends on [[yii\bootstrap\BootstrapAsset]], contains Bootstrap default theme CSS. + +Particular application needs may require different bundle (or bundle combination) usage. +If you need only CSS styles, [[yii\bootstrap\BootstrapAsset]] will be enough for you. However, if +you want to use Bootstrap JavaScript, you need to register [[yii\bootstrap\BootstrapPluginAsset]]. + +> Tip: most of the widgets register [[yii\bootstrap\BootstrapPluginAsset]] automatically. From 0755bd626b3dbc2fe6fa998a1670c64ee91494ef Mon Sep 17 00:00:00 2001 From: pana1990 Date: Sat, 30 May 2015 02:17:49 +0200 Subject: [PATCH 16/44] Add asset-bundles.md and helper-html.md in guide-es [skip ci] --- docs/guide-es/README.md | 2 ++ docs/guide-es/asset-bundles.md | 17 +++++++++++++++++ docs/guide-es/helper-html.md | 29 +++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 docs/guide-es/asset-bundles.md create mode 100644 docs/guide-es/helper-html.md diff --git a/docs/guide-es/README.md b/docs/guide-es/README.md index b22720c..74997be 100644 --- a/docs/guide-es/README.md +++ b/docs/guide-es/README.md @@ -20,6 +20,8 @@ Uso --- * [Yii widgets](usage-widgets.md) +* [Html helper](helper-html.md) +* [Asset Bundles](asset-bundles.md) Temas Adicionales ----------------- diff --git a/docs/guide-es/asset-bundles.md b/docs/guide-es/asset-bundles.md new file mode 100644 index 0000000..f27f800 --- /dev/null +++ b/docs/guide-es/asset-bundles.md @@ -0,0 +1,17 @@ +Asset Bundles +============= + +Bootstrap es una completa solución front-end, que incluye CSS, JavaScript, fuentes y mucho más. +Con el fin de permitir un control más flexible sobre los componentes de Bootstrap, esta extensión proporciona +varios asset bundles. +Ellos son: + +- [[yii\bootstrap\BootstrapAsset|BootstrapAsset]] - contiene unicamente los ficheros CSS principales. +- [[yii\bootstrap\BootstrapPluginAsset|BootstrapPluginAsset]] - depende de [[yii\bootstrap\BootstrapAsset]], contiene ficheros javascript. +- [[yii\bootstrap\BootstrapThemeAsset|BootstrapThemeAsset]] - depende de [[yii\bootstrap\BootstrapAsset]], contiene el tema CSS por defecto de Bootstrap. + +Particularmente las aplicaciones pueden necesitar requerir diferentes usos de bundle (o combinación de bundle). +Si necesitas unicamente estilos CSS, [[yii\bootstrap\BootstrapAsset]] será suficiente para ti. Sin embargo, si +quieres usar el JavaScript de Bootstrap, necesitas registrar [[yii\bootstrap\BootstrapPluginAsset]]. + +> Consejo: la mayoría de los widgets registran automaticamente [[yii\bootstrap\BootstrapPluginAsset]]. diff --git a/docs/guide-es/helper-html.md b/docs/guide-es/helper-html.md new file mode 100644 index 0000000..4cb067f --- /dev/null +++ b/docs/guide-es/helper-html.md @@ -0,0 +1,29 @@ +Html helper +=========== + +Bootstrap introduce muchas construcciones y esqueletos consistentes de HTML, que permiten crear diferentes efectos visuales. +Unicamente lo más complejo está cubierto por los widgets proporcionados en esta extensión. El resto debería ser +compuesto manualmente usando HTML directamente. +Sin embargo, algunas marcas especiales de Bootstrap son cubiertas por el helper [[\yii\bootstrap\Html]]. +[[\yii\bootstrap\Html]] es una versión mejorada de la regular [[\yii\helpers\Html]] dedicada a las necesidades de Bootstrap. +Proporciona varios métodos útiles: + + - `icon()` - permite renderizar iconos de Glyphicon + - `staticControl()` - permite renderizar formularios "static controls" + +[[\yii\bootstrap\Html]] hereda todas las funcionalidades disponibles en [[\yii\helpers\Html]] y puede usarse como sustituto, +así que no es necesario incluir ambos dentro de los archivos de tus vistas. +Por ejemplo: + +```php + + Html::icon('approve') . Html::encode('Save & apply'), + 'encodeLabel' => false, + 'options' => ['class' => 'btn-primary'], +]); ?> +``` + +> Atención: no confundas [[\yii\bootstrap\Html]] con [[\yii\helpers\Html]], ten cuidado que clases estás usando dentro de tus vistas. From 25b717a43c16be1daa7d307ff601199f047927f8 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sun, 31 May 2015 13:40:21 +0300 Subject: [PATCH 17/44] Replaced static with $this in phpdoc since current IDEs are finally able to handle it correctly --- ActiveField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ActiveField.php b/ActiveField.php index 55d24e0..634dc47 100644 --- a/ActiveField.php +++ b/ActiveField.php @@ -326,7 +326,7 @@ class ActiveField extends \yii\widgets\ActiveField /** * @param boolean $value whether to render a inline list - * @return static the field object itself + * @return $this the field object itself * Make sure you call this method before [[checkboxList()]] or [[radioList()]] to have any effect. */ public function inline($value = true) From df7e494b4f9c8204db4d91963fc9f07d78bc0c87 Mon Sep 17 00:00:00 2001 From: Nobuo Kihara Date: Thu, 4 Jun 2015 07:37:34 +0900 Subject: [PATCH 18/44] docs/guide small fixes [ci skip] --- docs/guide/asset-bundles.md | 8 ++++---- docs/guide/helper-html.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/guide/asset-bundles.md b/docs/guide/asset-bundles.md index d6cd382..6d7bd38 100644 --- a/docs/guide/asset-bundles.md +++ b/docs/guide/asset-bundles.md @@ -2,12 +2,12 @@ Asset Bundles ============= Bootstrap is a complex front-end solution, which includes CSS, JavaScript, fonts and so on. -In order to allow you most flexible control over Bootstrap components, this extension provides several asset bundles. +In order to allow you the most flexible control over Bootstrap components, this extension provides several asset bundles. They are: -- [[yii\bootstrap\BootstrapAsset|BootstrapAsset]] - contains only main CSS files. -- [[yii\bootstrap\BootstrapPluginAsset|BootstrapPluginAsset]] - depends on [[yii\bootstrap\BootstrapAsset]], contains javascript files. -- [[yii\bootstrap\BootstrapThemeAsset|BootstrapThemeAsset]] - depends on [[yii\bootstrap\BootstrapAsset]], contains Bootstrap default theme CSS. +- [[yii\bootstrap\BootstrapAsset|BootstrapAsset]] - contains only the main CSS files. +- [[yii\bootstrap\BootstrapPluginAsset|BootstrapPluginAsset]] - depends on [[yii\bootstrap\BootstrapAsset]], contains the javascript files. +- [[yii\bootstrap\BootstrapThemeAsset|BootstrapThemeAsset]] - depends on [[yii\bootstrap\BootstrapAsset]], contains the Bootstrap default theme CSS. Particular application needs may require different bundle (or bundle combination) usage. If you need only CSS styles, [[yii\bootstrap\BootstrapAsset]] will be enough for you. However, if diff --git a/docs/guide/helper-html.md b/docs/guide/helper-html.md index cd8d116..ed7fe27 100644 --- a/docs/guide/helper-html.md +++ b/docs/guide/helper-html.md @@ -2,7 +2,7 @@ Html helper =========== Bootstrap introduces many consistent HTML constructions and skeletons, which allow creating different visual effects. -Only the most complex of them are covered by widgets provided with this extension. The rest should be composed manually +Only the most complex of them are covered by the widgets provided with this extension. The rest should be composed manually using direct HTML composition. However, several special Bootstrap markup cases are covered by [[\yii\bootstrap\Html]] helper. [[\yii\bootstrap\Html]] is an enhanced version of the regular [[\yii\helpers\Html]] dedicated to the Bootstrap needs. @@ -11,7 +11,7 @@ It provides several useful methods: - `icon()` - allows rendering of Glyphicon icons - `staticControl()` - allows rendering of form "static controls" -[[\yii\bootstrap\Html]] inherits all functionality available at [[\yii\helpers\Html]] and can be used as substitute, +[[\yii\bootstrap\Html]] inherits all functionality available at [[\yii\helpers\Html]] and can be used as a substitute, so you don't need them both inside your view files. For example: @@ -26,5 +26,5 @@ use yii\bootstrap\Html; ]); ?> ``` -> Attention: do not confuse [[\yii\bootstrap\Html]] and [[\yii\helpers\Html]], be careful in which class - you are using inside your views. \ No newline at end of file +> Attention: do not confuse [[\yii\bootstrap\Html]] and [[\yii\helpers\Html]], be careful of which class + you are using inside your views. From 01451367b6a5ac76c58671430dbed6fd24fe58bd Mon Sep 17 00:00:00 2001 From: Nobuo Kihara Date: Thu, 4 Jun 2015 19:58:56 +0900 Subject: [PATCH 19/44] docs/guide-ja updated [ci skip] --- docs/guide-ja/README.md | 2 ++ docs/guide-ja/asset-bundles.md | 16 ++++++++++++++++ docs/guide-ja/helper-html.md | 28 ++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 docs/guide-ja/asset-bundles.md create mode 100644 docs/guide-ja/helper-html.md diff --git a/docs/guide-ja/README.md b/docs/guide-ja/README.md index 2b8ae37..c567ad1 100644 --- a/docs/guide-ja/README.md +++ b/docs/guide-ja/README.md @@ -20,6 +20,8 @@ Bootstrap のコアは二つの部分によって表されます。 -------- * [Yii ウィジェット](usage-widgets.md) +* [Html ヘルパ](helper-html.md) +* [アセットバンドル](asset-bundles.md) 追加のトピック -------------- diff --git a/docs/guide-ja/asset-bundles.md b/docs/guide-ja/asset-bundles.md new file mode 100644 index 0000000..98791f4 --- /dev/null +++ b/docs/guide-ja/asset-bundles.md @@ -0,0 +1,16 @@ +アセットバンドル +================ + +Bootstrap は、CSS、JavaScript、フォントなどを含む複雑なフロントエンドソリューションです。 +Bootstrap コンポーネントに対する最大限の柔軟な制御を可能にするために、このエクステンションはアセットバンドルをいくつかに分けて提供しています。 +すなわち、 + +- [[yii\bootstrap\BootstrapAsset|BootstrapAsset]] - メインの CSS ファイルのみを含みます。 +- [[yii\bootstrap\BootstrapPluginAsset|BootstrapPluginAsset]] - [[yii\bootstrap\BootstrapAsset]] に依存し、javascript ファイルを含みます。 +- [[yii\bootstrap\BootstrapThemeAsset|BootstrapThemeAsset]] - [[yii\bootstrap\BootstrapAsset]] に依存し、Bootstrap のデフォルトテーマの CSS を含みます。 + +個々のアプリケーションは、その要求に応じて、異なるバンドル (またはバンドルの組み合わせ) を必要とするでしょう。 +CSS のスタイルだけが必要なのであれば、[[yii\bootstrap\BootstrapAsset]] だけで十分です。 +しかし、Bootstrap の JavaScript を必要とする場合は、[[yii\bootstrap\BootstrapPluginAsset]] を登録しなければなりません。 + +> Tip|ヒント: ほとんどのウィジェットは [[yii\bootstrap\BootstrapPluginAsset]] を自動的に登録します。 diff --git a/docs/guide-ja/helper-html.md b/docs/guide-ja/helper-html.md new file mode 100644 index 0000000..9ba2997 --- /dev/null +++ b/docs/guide-ja/helper-html.md @@ -0,0 +1,28 @@ +Html ヘルパ +=========== + +Bootstrap は、一貫性の高い多数の HTML 構文ないしはスケルトンを導入して、さまざまな視覚的効果の生成を可能にしています。 +このエクステンションによって提供されるウィジェットがカバーしているのは、その中の最も複雑なものだけです。 +残りのものは、直接に HTML 構文を使って、手作業で構築しなければなりません。 +ただし、いくつかの特別な Bootstrap マークアップについては、[[\yii\bootstrap\Html]] によってカバーされています。 +[[\yii\bootstrap\Html]] は通常の [[\yii\helpers\Html]] の拡張版であり、Bootstrap の要求に特化して、いくつかの便利なメソッドを提供するものです。 + + - `icon()` - Glyphicon のアイコンのレンダリングを可能にする + - `staticControl()` - フォームの "static controls" のレンダリングを可能にする + +[[\yii\bootstrap\Html]] は [[\yii\helpers\Html]] で利用できる全ての機能を継承しており、その代替物として使うことが出来ますので、ビューファイルの中で両方を使う必要はありません。 +例えば、 + +```php + + Html::icon('approve') . Html::encode('Save & apply'), + 'encodeLabel' => false, + 'options' => ['class' => 'btn-primary'], +]); ?> +``` + +> 注意: [[\yii\bootstrap\Html]] と [[\yii\helpers\Html]] を混同してはいけません。 + ビューの中でどちらのクラスを使っているのかに注意してください。 From 61e29c448bac1cd0a8e2b49bf69361b5adf35c26 Mon Sep 17 00:00:00 2001 From: Brett O'Donnell Date: Tue, 23 Jun 2015 18:48:04 +0930 Subject: [PATCH 20/44] update example to use navbar-nav class if you try to render the nav without this class it renders each item on its own line. this change means they are rendered inline as expected. --- NavBar.php | 1 + 1 file changed, 1 insertion(+) diff --git a/NavBar.php b/NavBar.php index f67f32b..10fc7da 100644 --- a/NavBar.php +++ b/NavBar.php @@ -27,6 +27,7 @@ use yii\helpers\ArrayHelper; * ['label' => 'Home', 'url' => ['/site/index']], * ['label' => 'About', 'url' => ['/site/about']], * ], + * 'options' => ['class' => 'navbar-nav'], * ]); * NavBar::end(); * ``` From ef54b7f39ff8fcaca3aad81cce2f0c752bff6092 Mon Sep 17 00:00:00 2001 From: Nikola Kovacs Date: Wed, 22 Jul 2015 10:54:34 +0200 Subject: [PATCH 21/44] Fix phpdoc it's not a function parameter --- NavBar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NavBar.php b/NavBar.php index 10fc7da..9593a65 100644 --- a/NavBar.php +++ b/NavBar.php @@ -61,7 +61,7 @@ class NavBar extends Widget */ public $brandLabel = false; /** - * @param array|string|boolean $url the URL for the brand's hyperlink tag. This parameter will be processed by [[Url::to()]] + * @var array|string|boolean $url the URL for the brand's hyperlink tag. This parameter will be processed by [[Url::to()]] * and will be used for the "href" attribute of the brand link. Default value is false that means * [[\yii\web\Application::homeUrl]] will be used. */ From ad28c10c431e8a56b599a282fa417523961cb5b1 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 28 Jul 2015 09:21:46 +0300 Subject: [PATCH 22/44] Added link to guide --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d647349..0d72d49 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ in Yii applications extremely easy. For license information check the [LICENSE](LICENSE.md)-file. +Documentation is at [docs/guide/README.md](docs/guide/README.md). + [![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-bootstrap/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-bootstrap) [![Total Downloads](https://poser.pugx.org/yiisoft/yii2-bootstrap/downloads.png)](https://packagist.org/packages/yiisoft/yii2-bootstrap) [![Build Status](https://travis-ci.org/yiisoft/yii2-bootstrap.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-bootstrap) From 51ed559fe2ef9d33217e47a0ac77ffaa15f57c30 Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Thu, 13 Aug 2015 11:37:56 +0300 Subject: [PATCH 23/44] 'yiisoft/yii2' package dependency version switched to '2.0.6' --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 87b1212..5faca27 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "yiisoft/yii2": ">=2.0.x-dev", + "yiisoft/yii2": ">=2.0.6", "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*" }, "autoload": { From 27521dbd39ac0bfe303fd2d3bc173f03188675d0 Mon Sep 17 00:00:00 2001 From: Niek Oost Date: Thu, 27 Aug 2015 14:35:26 +0200 Subject: [PATCH 24/44] Minor typo repaired Changed "the text of the brand of false" into "the text of the brand or false" --- NavBar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NavBar.php b/NavBar.php index 9593a65..15125d1 100644 --- a/NavBar.php +++ b/NavBar.php @@ -56,7 +56,7 @@ class NavBar extends Widget */ public $containerOptions = []; /** - * @var string|boolean the text of the brand of false if it's not used. Note that this is not HTML-encoded. + * @var string|boolean the text of the brand or false if it's not used. Note that this is not HTML-encoded. * @see http://getbootstrap.com/components/#navbar */ public $brandLabel = false; From c25dc1e23d188954b546f6bd95def1027d91113b Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 17 Sep 2015 15:11:22 +0200 Subject: [PATCH 25/44] cleanup phpdoc --- ActiveField.php | 1 + BaseHtml.php | 10 ++++++---- Collapse.php | 1 - 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ActiveField.php b/ActiveField.php index 634dc47..96ce103 100644 --- a/ActiveField.php +++ b/ActiveField.php @@ -298,6 +298,7 @@ class ActiveField extends \yii\widgets\ActiveField * * @return $this the field object itself * @since 2.0.5 + * @see http://getbootstrap.com/css/#forms-controls-static */ public function staticControl($options = []) { diff --git a/BaseHtml.php b/BaseHtml.php index 3b97ed2..7096797 100644 --- a/BaseHtml.php +++ b/BaseHtml.php @@ -20,8 +20,7 @@ use yii\helpers\ArrayHelper; class BaseHtml extends \yii\helpers\Html { /** - * Composes icon HTML. - * @see http://getbootstrap.com/components/#glyphicons + * Composes icon HTML for bootstrap Glyphicons. * @param string $name icon short name, for example: 'star' * @param array $options the tag options in terms of name-value pairs. These will be rendered as * the attributes of the resulting tag. There are also a special options: @@ -30,6 +29,7 @@ class BaseHtml extends \yii\helpers\Html * - prefix: string, prefix which should be used to compose tag class, by default 'glyphicon glyphicon-' is used. * * @return string icon HTML. + * @see http://getbootstrap.com/components/#glyphicons */ public static function icon($name, $options = []) { @@ -41,7 +41,7 @@ class BaseHtml extends \yii\helpers\Html /** * Renders Bootstrap static form control. - * @see http://getbootstrap.com/css/#forms-controls-static + * * By default value will be HTML-encoded using [[encode()]], you may control this behavior * via 'encode' option. * @param string $value static control value. @@ -51,6 +51,7 @@ class BaseHtml extends \yii\helpers\Html * - encode: boolean, whether value should be HTML-encoded or not. * * @return string generated HTML + * @see http://getbootstrap.com/css/#forms-controls-static */ public static function staticControl($value, $options = []) { @@ -72,6 +73,7 @@ class BaseHtml extends \yii\helpers\Html * about attribute expression. * @param array $options the tag options in terms of name-value pairs. See [[staticControl()]] for details. * @return string generated HTML + * @see staticControl() */ public static function activeStaticControl($model, $attribute, $options = []) { @@ -83,4 +85,4 @@ class BaseHtml extends \yii\helpers\Html } return static::staticControl($value, $options); } -} \ No newline at end of file +} diff --git a/Collapse.php b/Collapse.php index b2de61f..09335b7 100644 --- a/Collapse.php +++ b/Collapse.php @@ -65,7 +65,6 @@ class Collapse extends Widget * - contentOptions: optional, the HTML attributes of the group's content */ public $items = []; - /** * @var boolean whether the labels for header items should be HTML-encoded. */ From 1464f93834b1d5edb1f5625f7ffd6c3723fa4923 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 23 Sep 2015 19:48:24 +0200 Subject: [PATCH 26/44] release 2.0.5 --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00285ed..ab09b39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ Yii Framework 2 bootstrap extension Change Log ============================================== -2.0.5 under development ------------------------ +2.0.5 September 23, 2015 +------------------------ - Enh #15: Allowed overriding default Bootstrap CSS classes added by widgets (klimov-paul) - Enh #38: Added object support for `content` option in `Collapse` class (pana1990, ItsReddi) From 57bfe7637a96e7b53012696d1fd557f5a36d0712 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 23 Sep 2015 19:48:57 +0200 Subject: [PATCH 27/44] prepare for next release --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab09b39..c083a0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Yii Framework 2 bootstrap extension Change Log ============================================== +2.0.6 under development +----------------------- + + + 2.0.5 September 23, 2015 ------------------------ From c854a7028fcb7f36443fbf5dd3068c35d46002ae Mon Sep 17 00:00:00 2001 From: Daniel Gomez Pan Date: Tue, 29 Sep 2015 12:22:00 +0200 Subject: [PATCH 28/44] Add editorconfig [skip ci] --- .editorconfig | 14 ++++++++++++++ .gitattributes | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..257221d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes index 59ea3d7..08476fa 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,9 @@ # Ignore all test and documentation for archive +/.editorconfig export-ignore /.gitattributes export-ignore /.gitignore export-ignore /.scrutinizer.yml export-ignore /.travis.yml export-ignore /phpunit.xml.dist export-ignore /tests export-ignore -/docs export-ignore \ No newline at end of file +/docs export-ignore From ebc7aff0572a2969fc1e9bfd30f61ece9448f5d1 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Tue, 6 Oct 2015 22:52:17 +0200 Subject: [PATCH 29/44] navbar doc enhancement yiisoft/yii2#9845 --- NavBar.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NavBar.php b/NavBar.php index 15125d1..0a95d84 100644 --- a/NavBar.php +++ b/NavBar.php @@ -61,9 +61,10 @@ class NavBar extends Widget */ public $brandLabel = false; /** - * @var array|string|boolean $url the URL for the brand's hyperlink tag. This parameter will be processed by [[Url::to()]] + * @var array|string|boolean $url the URL for the brand's hyperlink tag. This parameter will be processed by [[\yii\helpers\Url::to()]] * and will be used for the "href" attribute of the brand link. Default value is false that means * [[\yii\web\Application::homeUrl]] will be used. + * You may set it to `null` if you want to have no link at all. */ public $brandUrl = false; /** From 2b6a84c5122358bc84ba58bd4c2f772443911d37 Mon Sep 17 00:00:00 2001 From: Lucas Barros Date: Wed, 7 Oct 2015 22:04:44 -0300 Subject: [PATCH 30/44] Sync with file on guide base readme.md file Sync with file on guide base readme.md file --- docs/guide-pt-BR/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/guide-pt-BR/README.md b/docs/guide-pt-BR/README.md index 0ab343a..2fd0340 100644 --- a/docs/guide-pt-BR/README.md +++ b/docs/guide-pt-BR/README.md @@ -20,6 +20,8 @@ Uso ----- * [Yii widgets](usage-widgets.md) +* [Html helper](helper-html.md) +* [Asset Bundles](asset-bundles.md) Tópicos Adicionais ----------------- From 710678873d58581dc040e8339938cd0787d72098 Mon Sep 17 00:00:00 2001 From: Lucas Barros Date: Wed, 7 Oct 2015 22:07:09 -0300 Subject: [PATCH 31/44] Sync with file on guide base file Sync with file on guide base file --- docs/guide-pt-BR/helper-html.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docs/guide-pt-BR/helper-html.md diff --git a/docs/guide-pt-BR/helper-html.md b/docs/guide-pt-BR/helper-html.md new file mode 100644 index 0000000..714ca12 --- /dev/null +++ b/docs/guide-pt-BR/helper-html.md @@ -0,0 +1,17 @@ +Bootstrap introduces many consistent HTML constructions and skeletons, which allow creating different visual effects. Only the most complex of them are covered by the widgets provided with this extension. The rest should be composed manually using direct HTML composition. However, several special Bootstrap markup cases are covered by [[\yii\bootstrap\Html]] helper. [[\yii\bootstrap\Html]] is an enhanced version of the regular [[\yii\helpers\Html]] dedicated to the Bootstrap needs. It provides several useful methods: + + icon() - allows rendering of Glyphicon icons + staticControl() - allows rendering of form "static controls" + +[[\yii\bootstrap\Html]] inherits all functionality available at [[\yii\helpers\Html]] and can be used as a substitute, so you don't need them both inside your view files. For example: + + + Html::icon('approve') . Html::encode('Save & apply'), + 'encodeLabel' => false, + 'options' => ['class' => 'btn-primary'], +]); ?> + + Attention: do not confuse [[\yii\bootstrap\Html]] and [[\yii\helpers\Html]], be careful of which class you are using inside your views. From a44084a4a4215a6efe1ce4d9223e1581907af5bb Mon Sep 17 00:00:00 2001 From: Lucas Barros Date: Wed, 7 Oct 2015 22:07:52 -0300 Subject: [PATCH 32/44] Sync with file on guide base file Sync with file on guide base file --- docs/guide-pt-BR/asset-bundles.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docs/guide-pt-BR/asset-bundles.md diff --git a/docs/guide-pt-BR/asset-bundles.md b/docs/guide-pt-BR/asset-bundles.md new file mode 100644 index 0000000..6d7bd38 --- /dev/null +++ b/docs/guide-pt-BR/asset-bundles.md @@ -0,0 +1,16 @@ +Asset Bundles +============= + +Bootstrap is a complex front-end solution, which includes CSS, JavaScript, fonts and so on. +In order to allow you the most flexible control over Bootstrap components, this extension provides several asset bundles. +They are: + +- [[yii\bootstrap\BootstrapAsset|BootstrapAsset]] - contains only the main CSS files. +- [[yii\bootstrap\BootstrapPluginAsset|BootstrapPluginAsset]] - depends on [[yii\bootstrap\BootstrapAsset]], contains the javascript files. +- [[yii\bootstrap\BootstrapThemeAsset|BootstrapThemeAsset]] - depends on [[yii\bootstrap\BootstrapAsset]], contains the Bootstrap default theme CSS. + +Particular application needs may require different bundle (or bundle combination) usage. +If you need only CSS styles, [[yii\bootstrap\BootstrapAsset]] will be enough for you. However, if +you want to use Bootstrap JavaScript, you need to register [[yii\bootstrap\BootstrapPluginAsset]]. + +> Tip: most of the widgets register [[yii\bootstrap\BootstrapPluginAsset]] automatically. From 062a838dfe0581d4f4a951164e264eced358e93d Mon Sep 17 00:00:00 2001 From: Lucas Barros Date: Thu, 15 Oct 2015 01:05:06 -0300 Subject: [PATCH 33/44] 100% done in ptBR 100% done in ptBR --- docs/guide-pt-BR/helper-html.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/guide-pt-BR/helper-html.md b/docs/guide-pt-BR/helper-html.md index 714ca12..27ccdd1 100644 --- a/docs/guide-pt-BR/helper-html.md +++ b/docs/guide-pt-BR/helper-html.md @@ -1,9 +1,10 @@ -Bootstrap introduces many consistent HTML constructions and skeletons, which allow creating different visual effects. Only the most complex of them are covered by the widgets provided with this extension. The rest should be composed manually using direct HTML composition. However, several special Bootstrap markup cases are covered by [[\yii\bootstrap\Html]] helper. [[\yii\bootstrap\Html]] is an enhanced version of the regular [[\yii\helpers\Html]] dedicated to the Bootstrap needs. It provides several useful methods: +Bootstrap introduz construções HTML mais consistentes e esqueletos, que permitem a criação de diferentes efeitos visuais. Apenas o mais complexos deles são cobertos por os widgets fornecidos com esta extensão . O restante deverá ser escrito manualmente usando escrita HTML direta. No entanto, vários casos especiais de marcação Bootstrap são cobertos pelo helper [[\yii\bootstrap\Html]]. [[\yii\bootstrap\Html]] é uma versão melhorada de [[\yii\helpers\Html]] dedicada à quem precisa do Bootstrap. Ele fornece vários métodos úteis : icon() - allows rendering of Glyphicon icons staticControl() - allows rendering of form "static controls" -[[\yii\bootstrap\Html]] inherits all functionality available at [[\yii\helpers\Html]] and can be used as a substitute, so you don't need them both inside your view files. For example: +[[\yii\bootstrap\Html]] herda toda funcionalidade disponível em [[\yii\helpers\Html]] e pode ser usado como um substituto , para que você não precisa de ambos dentro de seus arquivos de views . Por exemplo: + ['class' => 'btn-primary'], ]); ?> - Attention: do not confuse [[\yii\bootstrap\Html]] and [[\yii\helpers\Html]], be careful of which class you are using inside your views. + Atenção: Não confunda [[\yii\bootstrap\Html]] e [[\yii\helpers\Html]], tenha o cuidado de que classe você está usando dentro de seus arquivos de views. From e449ee16485ef63f04598478b9fbc1fd7384a27c Mon Sep 17 00:00:00 2001 From: Lucas Barros Date: Thu, 15 Oct 2015 12:58:14 -0300 Subject: [PATCH 34/44] 100% done in ptBR 100% done in ptBR --- docs/guide-pt-BR/asset-bundles.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/guide-pt-BR/asset-bundles.md b/docs/guide-pt-BR/asset-bundles.md index 6d7bd38..154b4e6 100644 --- a/docs/guide-pt-BR/asset-bundles.md +++ b/docs/guide-pt-BR/asset-bundles.md @@ -1,16 +1,15 @@ Asset Bundles ============= -Bootstrap is a complex front-end solution, which includes CSS, JavaScript, fonts and so on. -In order to allow you the most flexible control over Bootstrap components, this extension provides several asset bundles. -They are: +Bootstrap é uma solução complexa para front-end, o qual inclue CSS, JavaScript, fontes e assim por diante. +A fim de permitir que você tenha controle mais flexível sobre componentes Bootstrap , esta extensão fornece vários asset bundles. Eles são: -- [[yii\bootstrap\BootstrapAsset|BootstrapAsset]] - contains only the main CSS files. -- [[yii\bootstrap\BootstrapPluginAsset|BootstrapPluginAsset]] - depends on [[yii\bootstrap\BootstrapAsset]], contains the javascript files. -- [[yii\bootstrap\BootstrapThemeAsset|BootstrapThemeAsset]] - depends on [[yii\bootstrap\BootstrapAsset]], contains the Bootstrap default theme CSS. +- [[yii\bootstrap\BootstrapAsset|BootstrapAsset]] - Contém apenas arquivos CSS. +- [[yii\bootstrap\BootstrapPluginAsset|BootstrapPluginAsset]] - Depende de [[yii\bootstrap\BootstrapAsset]], contem os arquivos JavaScript. +- [[yii\bootstrap\BootstrapThemeAsset|BootstrapThemeAsset]] - depende de [[yii\bootstrap\BootstrapAsset]], contém o tema padrão do Bootstrap. -Particular application needs may require different bundle (or bundle combination) usage. -If you need only CSS styles, [[yii\bootstrap\BootstrapAsset]] will be enough for you. However, if -you want to use Bootstrap JavaScript, you need to register [[yii\bootstrap\BootstrapPluginAsset]]. +Necessidades de aplicações específicas podem exigir utilização de pacotes diferentes ( ou a combinação bundle). +Se você precisa apenas de estilos CSS, [[yii\bootstrap\BootstrapAsset]] será o suficiente para você. No entanto , se +você quiser usar Bootstrap JavaScript, você precisa se registrar [[yii\bootstrap\BootstrapPluginAsset]]. -> Tip: most of the widgets register [[yii\bootstrap\BootstrapPluginAsset]] automatically. +> Tip: a maioria dos widgets [[yii\bootstrap\BootstrapPluginAsset]] registram automaticamente. From 09a5bfe72c0141ad26281848f1ae9c3f42541f20 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 25 Oct 2015 22:18:48 +0100 Subject: [PATCH 35/44] fixed broken phpdoc links --- ActiveForm.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ActiveForm.php b/ActiveForm.php index a574fbf..164c613 100644 --- a/ActiveForm.php +++ b/ActiveForm.php @@ -22,10 +22,10 @@ use yii\base\InvalidConfigException; * $form = ActiveForm::begin(['layout' => 'horizontal']) * ``` * - * This will set default values for the [[yii\bootstrap\ActiveField|ActiveField]] - * to render horizontal form fields. In particular the [[yii\bootstrap\ActiveField::template|template]] + * This will set default values for the [[ActiveField]] + * to render horizontal form fields. In particular the [[ActiveField::template|template]] * is set to `{label} {beginWrapper} {input} {error} {endWrapper} {hint}` and the - * [[yii\bootstrap\ActiveField::horizontalCssClasses|horizontalCssClasses]] are set to: + * [[ActiveField::horizontalCssClasses|horizontalCssClasses]] are set to: * * ```php * [ @@ -56,7 +56,7 @@ use yii\base\InvalidConfigException; * ]); * ``` * - * @see \yii\bootstrap\ActiveField for details on the [[fieldConfig]] options + * @see ActiveField for details on the [[fieldConfig]] options * @see http://getbootstrap.com/css/#forms * * @author Michael Härtl From 6fd96d4bf965625a29090e43fcc2870e279ae20d Mon Sep 17 00:00:00 2001 From: freezy Date: Sun, 15 Nov 2015 09:25:02 +0100 Subject: [PATCH 36/44] fixed Coding Standard errors --- ActiveField.php | 4 ++-- Html.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ActiveField.php b/ActiveField.php index 96ce103..5dccf27 100644 --- a/ActiveField.php +++ b/ActiveField.php @@ -254,7 +254,7 @@ class ActiveField extends \yii\widgets\ActiveField 'labelOptions' => ['class' => 'checkbox-inline'], ]; } - } elseif (!isset($options['item'])) { + } elseif (!isset($options['item'])) { $options['item'] = function ($index, $label, $name, $checked, $value) { return '
    ' . Html::checkbox($name, $checked, ['label' => $label, 'value' => $value]) . '
    '; }; @@ -280,7 +280,7 @@ class ActiveField extends \yii\widgets\ActiveField 'labelOptions' => ['class' => 'radio-inline'], ]; } - } elseif (!isset($options['item'])) { + } elseif (!isset($options['item'])) { $options['item'] = function ($index, $label, $name, $checked, $value) { return '
    ' . Html::radio($name, $checked, ['label' => $label, 'value' => $value]) . '
    '; }; diff --git a/Html.php b/Html.php index 95f2e25..1941106 100644 --- a/Html.php +++ b/Html.php @@ -19,4 +19,4 @@ namespace yii\bootstrap; */ class Html extends BaseHtml { -} \ No newline at end of file +} From 7644ecbc447907bac1e29fc6babc4b5e747523dd Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Fri, 20 Nov 2015 17:16:18 +0100 Subject: [PATCH 37/44] Fixes #92: Allow overriding `data-toggle` in `yii\bootstrap\Tabs` --- CHANGELOG.md | 1 + Tabs.php | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c083a0a..c724ab7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Yii Framework 2 bootstrap extension Change Log - Enh #43: Added support for the static form controls via `yii\bootstrap\Html` (klimov-paul) - Enh #44: Fixed `yii\bootstrap\ButtonDropdown` renders two buttons with the same id, if 'split' is enabled (klimov-paul) - Enh #50: Added `dropDownOptions` that is passed to `yii\bootstrap\Nav` dropdown items (fbau123) +- Enh #92: Allow overriding `data-toggle` in `yii\bootstrap\Tabs` (machour) 2.0.4 May 10, 2015 diff --git a/Tabs.php b/Tabs.php index f60724f..c6bc35f 100644 --- a/Tabs.php +++ b/Tabs.php @@ -169,7 +169,9 @@ class Tabs extends Widget } Html::addCssClass($linkOptions, ['widget' => 'dropdown-toggle']); - $linkOptions['data-toggle'] = 'dropdown'; + if (!isset($linkOptions['data-toggle'])) { + $linkOptions['data-toggle'] = 'dropdown'; + } $header = Html::a($label, "#", $linkOptions) . "\n" . Dropdown::widget(['items' => $item['items'], 'clientOptions' => false, 'view' => $this->getView()]); } else { @@ -185,7 +187,9 @@ class Tabs extends Widget if (isset($item['url'])) { $header = Html::a($label, $item['url'], $linkOptions); } else { - $linkOptions['data-toggle'] = 'tab'; + if (!isset($linkOptions['data-toggle'])) { + $linkOptions['data-toggle'] = 'tab'; + } $header = Html::a($label, '#' . $options['id'], $linkOptions); } @@ -250,8 +254,9 @@ class Tabs extends Widget $options['id'] = ArrayHelper::getValue($options, 'id', $this->options['id'] . '-dd' . $itemNumber . '-tab' . $n); $item['url'] = '#' . $options['id']; - $item['linkOptions']['data-toggle'] = 'tab'; - + if (!isset($item['linkOptions']['data-toggle'])) { + $item['linkOptions']['data-toggle'] = 'tab'; + } $panes[] = Html::tag('div', $content, $options); unset($item); From e2906b95e40ad787943fb5501e6d68384f0300e4 Mon Sep 17 00:00:00 2001 From: Jason Hancock Date: Tue, 24 Nov 2015 23:38:34 -0800 Subject: [PATCH 38/44] Document the "encode" option for Nav items --- Nav.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Nav.php b/Nav.php index d59e9b0..a003d41 100644 --- a/Nav.php +++ b/Nav.php @@ -66,6 +66,7 @@ class Nav extends Widget * - dropDownOptions: array, optional, the HTML options that will passed to the [[Dropdown]] widget. * - items: array|string, optional, the configuration array for creating a [[Dropdown]] widget, * or a string representing the dropdown menu. Note that Bootstrap does not support sub-dropdown menus. + * - encode: boolean, optional, whether the label will be HTML-encoded. If set, supersedes the $encodeLabels option for only this item. * * If a menu item is a string, it will be rendered directly without HTML encoding. */ From 68c1b6eba88fed7e0d57bde5a734d3d1d5e2a923 Mon Sep 17 00:00:00 2001 From: Daniel Gomez Pan Date: Mon, 7 Dec 2015 07:12:50 +0100 Subject: [PATCH 39/44] Update travis --- .travis.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index a94ff31..a6536e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,15 +6,13 @@ php: - 5.6 - 7.0 - hhvm - - hhvm-nightly # run build against hhvm but allow them to fail # http://docs.travis-ci.com/user/build-configuration/#Rows-That-are-Allowed-To-Fail -matrix: - fast_finish: true - allow_failures: - - php: hhvm-nightly - - php: 7.0 +#matrix: +# fast_finish: true +# allow_failures: +# - php: 7.0 # faster builds on new travis setup not using sudo sudo: false From 044e9f153ef3a5f87ef1abcb711fb6d7312a68c7 Mon Sep 17 00:00:00 2001 From: Daniel Gomez Pan Date: Mon, 7 Dec 2015 07:59:16 +0100 Subject: [PATCH 40/44] Update composer-asset-plugin --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a6536e0..b21f51e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ cache: install: - travis_retry composer self-update && composer --version - - travis_retry composer global require "fxp/composer-asset-plugin:~1.0.0" + - travis_retry composer global require "fxp/composer-asset-plugin:~1.1.1" - export PATH="$HOME/.composer/vendor/bin:$PATH" - travis_retry composer install --prefer-dist --no-interaction From c7f0b792047fd8270abdd27a6767d3699cf584e1 Mon Sep 17 00:00:00 2001 From: Daniel Gomez Pan Date: Mon, 7 Dec 2015 12:23:28 +0100 Subject: [PATCH 41/44] Remove block comment [skip ci] --- .travis.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index b21f51e..f4123cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,13 +7,6 @@ php: - 7.0 - hhvm -# run build against hhvm but allow them to fail -# http://docs.travis-ci.com/user/build-configuration/#Rows-That-are-Allowed-To-Fail -#matrix: -# fast_finish: true -# allow_failures: -# - php: 7.0 - # faster builds on new travis setup not using sudo sudo: false From e7b4df436f09ca00f44615928909fa9cc2a78ae7 Mon Sep 17 00:00:00 2001 From: Agiel Kurniawan Saputra <13nightevil@gmail.com> Date: Thu, 10 Dec 2015 19:36:27 +0700 Subject: [PATCH 42/44] Fixes #98: Fixed `yii\bootstrap\ButtonDropdown` setting `href` attribute for non `a` tags --- ButtonDropdown.php | 2 +- CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ButtonDropdown.php b/ButtonDropdown.php index 1a379d7..5993217 100644 --- a/ButtonDropdown.php +++ b/ButtonDropdown.php @@ -113,7 +113,7 @@ class ButtonDropdown extends Widget } else { $label .= ' '; $options = $this->options; - if (!isset($options['href'])) { + if (!isset($options['href']) && $this->tagName === 'a') { $options['href'] = '#'; } Html::addCssClass($options, ['toggle' => 'dropdown-toggle']); diff --git a/CHANGELOG.md b/CHANGELOG.md index c724ab7..902d877 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Yii Framework 2 bootstrap extension Change Log 2.0.6 under development ----------------------- - +- Bug #98: Fixed `yii\bootstrap\ButtonDropdown` setting `href` attribute for non `a` tags (13nightevil) 2.0.5 September 23, 2015 ------------------------ From b090985493f273b100419bf13215206ee490db6b Mon Sep 17 00:00:00 2001 From: Nobuo Kihara Date: Tue, 15 Dec 2015 18:57:02 +0900 Subject: [PATCH 43/44] docs/guide-ja block type identifier fixed [ci skip] --- docs/guide-ja/asset-bundles.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide-ja/asset-bundles.md b/docs/guide-ja/asset-bundles.md index 98791f4..ccfbe93 100644 --- a/docs/guide-ja/asset-bundles.md +++ b/docs/guide-ja/asset-bundles.md @@ -13,4 +13,4 @@ Bootstrap コンポーネントに対する最大限の柔軟な制御を可能 CSS のスタイルだけが必要なのであれば、[[yii\bootstrap\BootstrapAsset]] だけで十分です。 しかし、Bootstrap の JavaScript を必要とする場合は、[[yii\bootstrap\BootstrapPluginAsset]] を登録しなければなりません。 -> Tip|ヒント: ほとんどのウィジェットは [[yii\bootstrap\BootstrapPluginAsset]] を自動的に登録します。 +> Tip: ほとんどのウィジェットは [[yii\bootstrap\BootstrapPluginAsset]] を自動的に登録します。 From 9e79615cda09d5192bbf123908a8554e416fa85c Mon Sep 17 00:00:00 2001 From: "hobart.wang" Date: Sat, 19 Dec 2015 22:51:07 +0800 Subject: [PATCH 44/44] correct the Example of comment in the example,use Nav not Menu --- NavBar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NavBar.php b/NavBar.php index 0a95d84..acaebf8 100644 --- a/NavBar.php +++ b/NavBar.php @@ -19,7 +19,7 @@ use yii\helpers\ArrayHelper; * * ```php * use yii\bootstrap\NavBar; - * use yii\widgets\Menu; + * use yii\bootstrap\Nav; * * NavBar::begin(['brandLabel' => 'NavBar Test']); * echo Nav::widget([