Commit b1460fe5 by Alexander Kochetov

Bundle names fixes, base widget fixes, other widgets fixes

parent 0763684e
...@@ -77,6 +77,7 @@ class Alert extends Widget ...@@ -77,6 +77,7 @@ class Alert extends Widget
{ {
parent::init(); parent::init();
$this->getView()->registerAssetBundle('yii/bootstrap/alert');
$this->initOptions(); $this->initOptions();
echo Html::beginTag('div', $this->options) . "\n"; echo Html::beginTag('div', $this->options) . "\n";
......
...@@ -102,6 +102,7 @@ class Modal extends Widget ...@@ -102,6 +102,7 @@ class Modal extends Widget
{ {
parent::init(); parent::init();
$this->getView()->registerAssetBundle('yii/bootstrap/modal');
$this->initOptions(); $this->initOptions();
echo $this->renderToggleButton() . "\n"; echo $this->renderToggleButton() . "\n";
......
...@@ -68,6 +68,7 @@ class TypeAhead extends Widget ...@@ -68,6 +68,7 @@ class TypeAhead extends Widget
*/ */
public function run() public function run()
{ {
$this->getView()->registerAssetBundle('yii/bootstrap/typeahead');
echo $this->renderField(); echo $this->renderField();
$this->registerPlugin('typeahead'); $this->registerPlugin('typeahead');
} }
......
...@@ -25,7 +25,10 @@ class Widget extends \yii\base\Widget ...@@ -25,7 +25,10 @@ class Widget extends \yii\base\Widget
* @var boolean whether to use the responsive version of Bootstrap. * @var boolean whether to use the responsive version of Bootstrap.
*/ */
public static $responsive = true; public static $responsive = true;
/**
* @var boolean whether to use the transition effects.
*/
public static $transition = true;
/** /**
* @var array the HTML attributes for the widget container tag. * @var array the HTML attributes for the widget container tag.
*/ */
...@@ -67,9 +70,11 @@ class Widget extends \yii\base\Widget ...@@ -67,9 +70,11 @@ class Widget extends \yii\base\Widget
{ {
$id = $this->options['id']; $id = $this->options['id'];
$view = $this->getView(); $view = $this->getView();
$view->registerAssetBundle(static::$responsive ? 'yii/bootstrap/responsive' : 'yii/bootstrap');
$bundle = static::$responsive ? 'yii/bootstrap-responsive' : 'yii/bootstrap'; if (static::$transition) {
$view->registerAssetBundle($bundle); $view->registerAssetBundle('yii/bootstrap/transition');
}
if ($this->pluginOptions !== false) { if ($this->pluginOptions !== false) {
$options = empty($this->pluginOptions) ? '' : Json::encode($this->pluginOptions); $options = empty($this->pluginOptions) ? '' : Json::encode($this->pluginOptions);
......
<?php <?php
return array( return array(
'yii/bootstrap/css' => array( 'yii/bootstrap' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'css' => array( 'css' => array(
YII_DEBUG ? 'css/bootstrap.css' : 'css/bootstrap.min.css', YII_DEBUG ? 'css/bootstrap.css' : 'css/bootstrap.min.css',
), ),
), ),
'yii/bootstrap/css-responsive' => array( 'yii/bootstrap/responsive' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'css' => array( 'css' => array(
YII_DEBUG ? 'css/bootstrap-responsive.css' : 'css/bootstrap-responsive.min.css', YII_DEBUG ? 'css/bootstrap-responsive.css' : 'css/bootstrap-responsive.min.css',
), ),
'depends' => array('yii/bootstrap/css'), 'depends' => array('yii/bootstrap'),
),
'yii/bootstrap/all' => array(
'sourcePath' => __DIR__ . '/assets',
'js' => array(
YII_DEBUG ? 'js/bootstrap.js' : 'js/bootstrap.min.js',
),
'depends' => array('yii/jquery', 'yii/bootstrap/css'),
), ),
'yii/bootstrap/affix' => array( 'yii/bootstrap/affix' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-affix.js', 'js/bootstrap-affix.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
'yii/bootstrap/alert' => array( 'yii/bootstrap/alert' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-alert.js', 'js/bootstrap-alert.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
'yii/bootstrap/button' => array( 'yii/bootstrap/button' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-button.js', 'js/bootstrap-button.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
'yii/bootstrap/carousel' => array( 'yii/bootstrap/carousel' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-carousel.js', 'js/bootstrap-carousel.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
'yii/bootstrap/collapse' => array( 'yii/bootstrap/collapse' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-collapse.js', 'js/bootstrap-collapse.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
'yii/bootstrap/dropdown' => array( 'yii/bootstrap/dropdown' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-dropdown.js', 'js/bootstrap-dropdown.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
'yii/bootstrap/modal' => array( 'yii/bootstrap/modal' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-modal.js', 'js/bootstrap-modal.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
'yii/bootstrap/popover' => array( 'yii/bootstrap/popover' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-popover.js', 'js/bootstrap-popover.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/tooltip', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap/tooltip', 'yii/bootstrap'),
), ),
'yii/bootstrap/scrollspy' => array( 'yii/bootstrap/scrollspy' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-scrollspy.js', 'js/bootstrap-scrollspy.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
'yii/bootstrap/tab' => array( 'yii/bootstrap/tab' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-tab.js', 'js/bootstrap-tab.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
'yii/bootstrap/tooltip' => array( 'yii/bootstrap/tooltip' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-tooltip.js', 'js/bootstrap-tooltip.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
'yii/bootstrap/transition' => array( 'yii/bootstrap/transition' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-transition.js', 'js/bootstrap-transition.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
'yii/bootstrap/typeahead' => array( 'yii/bootstrap/typeahead' => array(
'sourcePath' => __DIR__ . '/assets', 'sourcePath' => __DIR__ . '/assets',
'js' => array( 'js' => array(
'js/bootstrap-typeahead.js', 'js/bootstrap-typeahead.js',
), ),
'depends' => array('yii/jquery', 'yii/bootstrap/css'), 'depends' => array('yii/jquery', 'yii/bootstrap'),
), ),
); );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment