Commit 49550706 by Crisu83

added public method for registering Bootstrap JS

parent 569cb820
...@@ -83,7 +83,7 @@ class Bootstrap extends CApplicationComponent ...@@ -83,7 +83,7 @@ class Bootstrap extends CApplicationComponent
$this->registerYiiCss(); $this->registerYiiCss();
if ($this->enableJS) if ($this->enableJS)
$this->registerCorePlugins(); $this->registerCoreScripts();
} }
/** /**
...@@ -116,18 +116,27 @@ class Bootstrap extends CApplicationComponent ...@@ -116,18 +116,27 @@ class Bootstrap extends CApplicationComponent
} }
/** /**
* Registers the core JavaScript plugins. * Registers the core JavaScript.
* @since 0.9.8 * @since 0.9.8
*/ */
public function registerCorePlugins() public function registerCoreScripts()
{
$this->registerJS();
$this->registerTooltip();
$this->registerPopover();
}
/**
* Registers the Bootstrap JavaScript.
* @param int $position the position of the JavaScript code.
* @see CClientScript::registerScriptFile
*/
public function registerJS($position = CClientScript::POS_HEAD)
{ {
/** @var CClientScript $cs */ /** @var CClientScript $cs */
$cs = Yii::app()->getClientScript(); $cs = Yii::app()->getClientScript();
$cs->registerCoreScript('jquery'); $cs->registerCoreScript('jquery');
$cs->registerScriptFile($this->getAssetsUrl().'/js/bootstrap.min.js'); $cs->registerScriptFile($this->getAssetsUrl().'/js/bootstrap.min.js', $position);
$this->registerTooltip();
$this->registerPopover();
} }
/** /**
......
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