From 16b0bd32623ce4913294057e642edb89e1b204ee Mon Sep 17 00:00:00 2001 From: amrbedair Date: Fri, 30 May 2014 21:10:53 +0200 Subject: [PATCH] v4.0.0 --- INSTALL.md | 4 ++-- src/assets/css/bootstrap-yii.css | 6 ++++-- src/components/Booster.php | 19 +++++++++++++++++- src/filters/BoosterFilter.php | 33 ++++++++++++++++++++++++++++++++ src/filters/BootstrapFilter.php | 33 -------------------------------- src/widgets/TbDataColumn.php | 20 ++++++++++--------- 6 files changed, 68 insertions(+), 47 deletions(-) create mode 100644 src/filters/BoosterFilter.php delete mode 100644 src/filters/BootstrapFilter.php diff --git a/INSTALL.md b/INSTALL.md index b9acfbdf..7b30d14f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -35,11 +35,11 @@ You have to write something like this inside each Controller you want to have Yi public function filters() { return array( ... probably other filter specifications ... - array('path.alias.to.bootstrap.filters.BootstrapFilter - delete') + array('path.alias.to.bootstrap.filters.BoosterFilter - delete') ); } -`.filters.BootstrapFilter` snippet has to be written verbatim - it is the path to subfolder under the YiiBooster directory. +`.filters.BoosterFilter` snippet has to be written verbatim - it is the path to subfolder under the YiiBooster directory. This example declaration will tell the Controller in question to load `Bootstrap` component on any action except `delete` one. You can look at the [documentation for CController.filters() method](http://www.yiiframework.com/doc/api/CController#filters-detail) diff --git a/src/assets/css/bootstrap-yii.css b/src/assets/css/bootstrap-yii.css index 34e6537a..001c15cc 100644 --- a/src/assets/css/bootstrap-yii.css +++ b/src/assets/css/bootstrap-yii.css @@ -61,15 +61,17 @@ table.table { display: none; position: absolute; right: 5px; - top: 7px; + top: 8px; } .grid-view table.items th a.asc .caret { + border-top: 8px solid; + border-bottom: none; display: block; } .grid-view table.items th a.desc .caret { - border-bottom: 8px solid #000000; + border-bottom: 8px solid; border-top: none; display: block; } diff --git a/src/components/Booster.php b/src/components/Booster.php index 6db58b5f..40aae02e 100644 --- a/src/components/Booster.php +++ b/src/components/Booster.php @@ -141,6 +141,10 @@ class Booster extends CApplicationComponent { * @since YiiBooster 1.0.6 */ public $forceCopyAssets = false; + + public $enablePopover = true; + + public $enableTooltip = true; /** * @var string Default popover target CSS selector. @@ -339,7 +343,12 @@ protected function registerJsPackagesIfEnabled() { if ($this->enableNotifierJS) $this->registerPackage('notify'); - + + if($this->enablePopover) + $this->registerPopoverJs(); + + if($this->enableTooltip) + $this->registerTooltipJs(); } @@ -482,6 +491,14 @@ public function registerFontAwesomeCss() { $this->registerPackage('font-awesome'); } + + public function registerPopoverJs() { + $this->cs->registerScript($this->getUniqueScriptId(), "jQuery('[data-toggle=popover]').popover();"); + } + + public function registerTooltipJs() { + $this->cs->registerScript($this->getUniqueScriptId(), "jQuery('[data-toggle=tooltip]').tooltip();"); + } /** * Generates a "somewhat" random id string. diff --git a/src/filters/BoosterFilter.php b/src/filters/BoosterFilter.php new file mode 100644 index 00000000..c1df6208 --- /dev/null +++ b/src/filters/BoosterFilter.php @@ -0,0 +1,33 @@ + + * @since v4.0.0 + */ + + +/** + *## Class BoosterFilter + * + * Filter to load Booster on specific actions. + * Then in a controller, add the new booster filter: + * public function filters() + * { + * return array( + * 'accessControl', + * 'postOnly + delete', + * array('ext.booster.filters.BoosterFilter - delete') + * ); + * } + * + * @package booster.filters + */ +class BoosterFilter extends CFilter { + + protected function preFilter($filterChain) { + + Yii::app()->getComponent("booster"); + return true; + } +} diff --git a/src/filters/BootstrapFilter.php b/src/filters/BootstrapFilter.php deleted file mode 100644 index 952ae078..00000000 --- a/src/filters/BootstrapFilter.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @date 18/12/12 09:35 AM - */ - - -/** - *## Class BootstrapFilter - * - * Filter to load Bootstrap on specific actions. - * Then in a controller, add the new bootstrap filter: - * public function filters() - * { - * return array( - * 'accessControl', - * 'postOnly + delete', - * array('ext.bootstrap.filters.BootstrapFilter - delete') - * ); - * } - * - * @package booster.filters - */ -class BootstrapFilter extends CFilter -{ - protected function preFilter($filterChain) - { - Yii::app()->getComponent("bootstrap"); - return true; - } -} diff --git a/src/widgets/TbDataColumn.php b/src/widgets/TbDataColumn.php index c0d3294e..5721fb86 100644 --- a/src/widgets/TbDataColumn.php +++ b/src/widgets/TbDataColumn.php @@ -38,15 +38,17 @@ protected function renderHeaderCellContent() $booster = Booster::getBooster(); - if ($sort->resolveAttribute($this->name) !== false){ - if($sort->getDirection($this->name) === CSort::SORT_ASC){ - $label .= ' '; - } elseif($sort->getDirection($this->name) === CSort::SORT_DESC){ - $label .= ' '; - } else { - $label .= ' '; - } - } + if ($sort->resolveAttribute($this->name) !== false) + $label .= ' '; + /* { + if($sort->getDirection($this->name) === CSort::SORT_ASC){ + $label .= ' '; + } elseif($sort->getDirection($this->name) === CSort::SORT_DESC){ + $label .= ' '; + } else { + $label .= ' '; + } + } */ echo $sort->link($this->name, $label, array('class' => 'sort-link')); } else {