Skip to content

Commit

Permalink
v4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbedair committed May 30, 2014
1 parent 1da1661 commit 16b0bd3
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 47 deletions.
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions src/assets/css/bootstrap-yii.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
19 changes: 18 additions & 1 deletion src/components/Booster.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -339,7 +343,12 @@ protected function registerJsPackagesIfEnabled() {

if ($this->enableNotifierJS)
$this->registerPackage('notify');


if($this->enablePopover)
$this->registerPopoverJs();

if($this->enableTooltip)
$this->registerTooltipJs();
}


Expand Down Expand Up @@ -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.
Expand Down
33 changes: 33 additions & 0 deletions src/filters/BoosterFilter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
*## BoosterFilter class file
*
* @author Amr Bedair <[email protected]>
* @since v4.0.0
*/


/**
*## Class BoosterFilter
*
* Filter to load Booster on specific actions.
* Then in a controller, add the new booster filter:
* <code>public function filters()
* {
* return array(
* 'accessControl',
* 'postOnly + delete',
* array('ext.booster.filters.BoosterFilter - delete')
* );
* }</code>
*
* @package booster.filters
*/
class BoosterFilter extends CFilter {

protected function preFilter($filterChain) {

Yii::app()->getComponent("booster");
return true;
}
}
33 changes: 0 additions & 33 deletions src/filters/BootstrapFilter.php

This file was deleted.

20 changes: 11 additions & 9 deletions src/widgets/TbDataColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 .= ' <span class="'.($booster->fontAwesomeCss ? 'fa fa-sort-asc' : 'icon-chevron-down').'"></span>';
} elseif($sort->getDirection($this->name) === CSort::SORT_DESC){
$label .= ' <span class="'.($booster->fontAwesomeCss ? 'fa fa-sort-desc' : 'icon-chevron-up').'"></span>';
} else {
$label .= ' ';
}
}
if ($sort->resolveAttribute($this->name) !== false)
$label .= ' <span class="caret"></span>';
/* {
if($sort->getDirection($this->name) === CSort::SORT_ASC){
$label .= ' <span class="'.($booster->fontAwesomeCss ? 'fa fa-sort-asc' : 'icon-chevron-down').'"></span>';
} elseif($sort->getDirection($this->name) === CSort::SORT_DESC){
$label .= ' <span class="'.($booster->fontAwesomeCss ? 'fa fa-sort-desc' : 'icon-chevron-up').'"></span>';
} else {
$label .= ' ';
}
} */

echo $sort->link($this->name, $label, array('class' => 'sort-link'));
} else {
Expand Down

0 comments on commit 16b0bd3

Please sign in to comment.