clevertech / yiibooster Goto Github PK
View Code? Open in Web Editor NEWYiiBooster
License: BSD 2-Clause "Simplified" License
YiiBooster
License: BSD 2-Clause "Simplified" License
the original yii formbuilder functionality use the CActiveForm . if we want change it to another one just specify the activeForm property of CForm . i v tried the original yii-bootstrap extension but it will display a ugly form to me , and i do post a feature request to chris83 . seems that he don't have too much time to do this . so i post the feature request here again , hope this feature will be accomplished !
thanks for your great working , this one is really nice as the yii-bootstrap is
Hello,
in TbRelationalColumn you reference the $data->id with the "fix" field id. As my models have "none" id ID's, I have the problem to use it. To solve it, I added an additional parameter to the class:
/**
@var string $columnID the ID for the data column
*/
public $columnID = 'id';
...
public function renderDataCell($row)
{
$data = $this->grid->dataProvider->data[$row];
$options = $this->htmlOptions;
if ($this->cssClassExpression !== null)
{
$class = $this->evaluateExpression($this->cssClassExpression, array('row' => $row, 'data' => $data));
if (isset($options['class']))
$options['class'] .= ' ' . $class;
else
$options['class'] = $class;
}
echo CHtml::openTag('td', $options);
echo CHtml::openTag('span', array('class' => $this->cssClass, 'data-rowid' => $data->{$this->columnID}));
$this->renderDataCellContent($row, $data);
echo '';
echo '';
}
...
Which I use as parameter in my ExtendedGridView! As I think, I'm not the only one facing this problem, maybe you will include a "clean" solution to your repository! ;)
cheers Phil
There is a missing top padding in radioButtonListRow and checkBoxListRow. In generation of radioButtonListRow or checkBoxListRow yii adds hidden field first after
.controls > .radio:first-child, .controls > .checkbox:first-child {
padding-top: 5px;
}
dont work.
May be change this style to something like
.controls > label.radio:nth-of-type(1), .controls > label.checkbox:nth-of-type(1) {
padding-top: 5px;
}
I'm unsure if I should request this on the Yii Booster project or the Yii Bootstrap project, but I'm currently using Yii Booster, so here goes :)
Can we have some sort of "type" override when passing in htmlOptions for forms? I wanted to support HTML5 input with new "type" values (see http://www.w3schools.com/html/html5_form_input_types.asp)
I noticed I couldn't set the actual "type" (default to text when using text field) despite trying to pass in array('type'=>'email'). It may seem a bit confusing since the primitive type is a text field, but I wanted to use define it as 'email' instead of 'text' so that, for example, when using the form under a mobile platform like iOS, it should display the appropriate keyboard. (Another example would be type="tel" for the telephone number keypad to come up).
Creating a new method for every type (again, an email really is just a text field), might be overkill. Instead, if a "type" is defined in htmlOptions, it can replace the value after it does the rest of its magic.
I can try to come up with an implementation this weekend. (I'm just now thinking about if the user doesn't set a type in htmlOptions, maybe we can even check the model to see if it's an email, telephone number, etc and auto-populate/replace it for the HTML5 equivalent)
When
'afterSortableUpdate' => 'js:function(id, position){ console.log("id: "+id+", position:"+position);}',
I get the position, independent of the current page number. that is, the position is always between zero ..n
This is a bug or a feature?
As I understand I need to get a position with the page number (position+page_num*limit). Or are there other ways?
Missing the public property filterHtmlOptions in the TbDataColumn component (used in function renderFilterCell).
/**
* Bootstrap grid data column.
*/
class TbDataColumn extends CDataColumn
{
public $filterHtmlOptions = array(); //<--- add this line
Sorting Icon which appears on hovering over on CGridview Column Header is appearing on the border of column.
Dropdown Button doesn't work on iPhone or iPad.
We can click on the button and see the list but we can't select any item in that list.
As a workaround, i'm passing additional options to widget:
'locale' => array(
'applyLabel' => Yii::t('app', 'Apply'),
'fromLabel' => Yii::t('app', 'From'),
'toLabel' => Yii::t('app', 'To'),
'customRangeLabel' => Yii::t('app', 'Custom'),
'daysOfWeek' => Yii::app()->locale->getWeekDayNames('narrow', true),
'monthNames' => array_values(Yii::app()->locale->getMonthNames('wide', true)),
),
But i think it would be great if daysOfWeek and monthNames would be passed by widget automatically from locale. Possibly, you should create component-specific messages for the other labels.
P.S. It looks like you should update daterangepicker.js, because 'monthNames' option isn't actually working.
In my app I have the following setup(created with yiiBootstrap, later migrated to yiiBooster)
Shortend:
<?php
$this->widget('bootstrap.widgets.TbNavbar',
array(
'fixed' => TbNavbar::FIXED_TOP,
//'htmlOptions' => array('class' => 'navbar-fixed-top'),
'type' => 'inverse',
'brand' => '<span class="branded">?????</span>',
'brandUrl' => $this->createUrl('/site/index'),
'collapse' => true,
'items' => array(
array(
'class' => 'bootstrap.widgets.TbMenu',
'htmlOptions' => array('class' => 'pull-left'),
'items' => array(
array('label' => 'Home', 'url' => $this->createUrl('/site/index'), 'active' => $this->isPartOfCurrent('category/index')),
array('label' => 'News', 'url' => $this->createUrl('/news'), 'active' => $this->isPartOfCurrent('news')),
array('label' => 'Plugins', 'url' => '#', 'active' => $this->isPartOfCurrent('plugin'), 'items' => array(
array('label' => 'Create New', 'url' => $this->createUrl('plugin/create'), 'visible' => !Yii::app()->user->isGuest, 'active' => $this->isPartOfCurrent('plugin/create')),
array('label' => 'Dokumentation', 'url' => $this->createUrl('site/documentation')),
array('label' => 'Categorys', 'url' => $this->createUrl('/category'), 'active' => $this->isPartOfCurrent('category')),
array('label' => 'Search', 'url' => $this->createUrl('/search'), 'active' => $this->isPartOfCurrent('addon/search')),
'---',
array('label' => 'Discuss', 'url' => $this->createUrl('/forum/cats/plugins')),
)),
),
),
'<form class="navbar-search pull-left" method="POST" action="' . $this->createUrl('/search') . '"><input type="text" name="searchtext" class="search-query span2" placeholder="Search Plugin"></form>',
.......
However the generated html looks like this:
<div class="navbar navbar-inverse navbar-fixed-1">
<div class="navbar-inner">
Notice the last class in the outer div navbar-fixed-1
instead of navbar-fixed-top
or navbar-fixed-bottom
.
To fix this I added navbar-fixed-top
by hand. (See commented line above).
Suppose I want to create a variable number of input fields, using an ajax request.
To enable this, I use the renderPartial function with the two last parameters set to "false, true".
This seems to be the only way to make sure the javascript is rendered as well.
The major issue is that in that case, the bootstrap scripts/css files are against included, which results in a conflict and prevents the widget from working.
This could be solved by adding the following code in bootstrap.php:
public $ajaxCssImport = true;
if(($this->ajaxCssImport && Yii::app()->request->isAjaxRequest) || !Yii::app()->request->isAjaxRequest ) {
// Prevents the extension from registering scripts and publishing assets when ran from the command line.
if (Yii::app() instanceof CConsoleApplication)
return;
if ($this->coreCss !== false)
$this->registerCoreCss();
if ($this->responsiveCss !== false)
$this->registerResponsiveCss();
if ($this->yiiCss !== false)
$this->registerYiiCss();
}
if ($this->enableJS !== false)
$this->registerCoreScripts();
See also a post on http://www.yiichina.net/forum/index.php/topic/34996-yii-ajax-duplicate-clientscripts/
If render modal in TbBox then there is a shadow in the browser IE 8
.bootstrap-widget { position: relative; ?????}
Hi, using TbTabs I always get this "error" in FireBug by clicking on one of the tabs:
elem = document.getElementById( match[2] );
And it looks like after the error came up, the menu doesn't work correct anymore..:( Do I need to assign an id for every tab to fix it?
Thanks!
checkBoxList is not working for many-to-many relationships.
This could solved by a fix in TbActiveForm.php in function "inputsList":
$checked = !is_array($select) && !strcmp($value, $select) || is_array($select) && in_array($value, $select);
In the case of a many-to-many relationship the above statement fill crash on the
"in_array($value, $select)" part.
This could be solved by replacing the "$checked = ..." assignment by the following statement:
$checked = !is_array($select) && !strcmp($value, $select) ||
is_array($select) && !empty($select) && !is_object($select[0]) && in_array($value, $select) ||
is_array($select) && !empty($select) && is_object($select[0]) && in_array($value, array_keys(GxHtml::listDataEx($select)));
Maybe there are better ways, but it would be great to have the support for many-to-many relationships working.
Best regards,
Gert Helsen
Include the amazing http://fortawesome.github.com/Font-Awesome/
Please add time select to datepickerRow.
Hi, in the TbBox Actions implementation, it's not possible to pass over all the ButtonOptions, e.g. I want to use some ajaxButtons to open some Dialogs, but it's not working, and even when I try to use the htmlOptions propertie, it's ignored...
Thx and cheers Phil
Trying to use buttongroup with dropdown:
$this->widget('bootstrap.widgets.TbButtonGroup', array(
'buttons'=>array(
array('label'=>_('Add new'),'url'=>array('create'),'icon'=>'plus'),
array('label'=>_('Search'), 'url'=>'#','icon'=>'search','htmlOptions'=>array('class'=>'search-button')),
array('label'=>_('Export'), 'icon'=>'download','items'=>array(
array('label'=>_('Excel'), 'url'=>array('exportXls')),
array('label'=>_('CSV'), 'url'=>array('exportCsv')),
)),
array('label'=>_('List'), 'url'=>array('index'),'icon'=>'th-list')
),
));
I get rounded border for dropdown and dropdown menu appears under "Add new" button
I think we need to do the on / off button like Tbbuttontsolumn style.
Instead of a huge button labeled with the same labels in the grid table we needs to be done just a href icons
Example is
<a ref="tooltip" title="checkedButtonLabel " href="toggleAction" class=..><i class="icon-ok-circle"></i></a>
then everything becomes beautiful and in the same style (Tbbuttontsolumn ) ;)
I think I should do pull request, what you thinks? :)
Missing $options
, $width
and $height
options.
Method timepickerField()
of classes TbInputVertical
and TbInputHorizontal
doesn't have append and prepend staff printing.
In class TbExtendedGridView:
Use case: We wish to display a list of employees with normal hours worked and overtime worked, and display an extended summary that adds up the "hours" and "overtime" columns separately. This is what we want:
Summary:
Total regular hours worked: 100
Total overtime hours worked: 10
In the config, we specify these two columns, and set the class to "TBSumOperation" for each one.
However, the way the extended summaries work, all columns with the same summary type (here, TbSumOperation) are added together, and only the first of these ("hours") is displayed in the summary, with total of the "hours" and "overtime" columns as its value. This is what we get:
Summary:
Total regular hours worked: 110
It would be much more useful to summarize the columns individually.
Workaround: Extend TbSumOperation as (for instance) TbSumOperation2, TbSumOperation3 and use these for column number 2, 3, etc., then add these to $extendedSummaryOperations.
$data->id
should be $data->getPrimaryKey()
TbRelationalColumn.php#L93
This could be reproduced via configuration:
'request' => array(
'enableCsrfValidation' => true,
),
Can you clarify if I can use this without buying a license?
Can I include Redactor in any products that I intend to give away for free?
Sure, you can do this after purchasing the Developer License. In this case, you are allowed to include Redactor in all your open source projects, including those published under GPL, BSD, etc.
This means that if clevertech have a developer license I can use it for free?
If not you should add a note.
The widget should be displayed on TbExtendedGridView and should be able to find whether a filter has been applied and provide a simple UI to save for later use.
Include a toggle column to the widget to have the ability to set on/off values in the grid.
It would be nice if the width of the input when editing could auto-adjust on typing or have a min-width option.
Right now it's nice that it matches the width when starting to edit, but if the current value is one character long then the input width to type in would be very small.
It's nice also not having to have a fixed set width. Sol like having a min and max width option would be nice.
On < IE9 rendering engines, SCRIPT1010: Expected identifier inside jqote2.min.js
Include http://www.larentis.eu/bootstrap_toggle_buttons/ to the library
At the moment TbExtendedGridView renders the model as if it has the 'id' property and it is assumed a CActiveDataProvider. Modify it so it can work with any IDataProvider.
Include http://jhollingworth.github.com/bootstrap-wysihtml5/ as an open source alternative to redactor
At this moment TbDatepicker widget code doesn't contains any references for registering localization file via asset manager. Even if i add it, it not works, because it seems that localization taken from https://github.com/eternicode/bootstrap-datepicker and all other datepicker code taken from http://www.eyecon.ro/bootstrap-datepicker/
So localization is not compatible with main datepicker code.
In TbExtendedGridView filtering does not work when the fixed header mode on.
I think that this is due to duplication of data entry fields.
http://yii-booster.clevertech.biz/getting-started.html
generatorsPath should be generatorPaths?
You should warn people that Highcharts JS is not free for commercial use.
By bundle it with this library a lot of developers are going to use it without knowing that and can have problems.
You could change to this http://nvd3.com/ for example.
https://github.com/clevertech/YiiBooster/blob/master/widgets/TbDatePicker.php#L80
Please add
list($name, $id) = $this->resolveNameID();
before line 80
TbDatePicker
widget and jQueryUI datepicker uses same semantics $(<selector>).datepicker()
for attaching to element.
If i use TbDatePicker
widget and jQueryUI widgets on same page then datepicker()
will be those script who loaded last.
Do you plan to add ajax feature in TbTabs like in CJuiTabs ?
Cuando creamos un botón con ventana modal si lo usas desde móvil no aparece la ventana.
Make options for using LESS
For example:
/* load bootstrap components /
'bootstrap' => array(
'class' => 'common.extensions.bootstrap.components.Bootstrap',
'less' => true
),
and in Bootstrap.php
/*
* Registers the Bootstrap LESS.
*/
public function registerCoreCss()
{
$this->registerAssetCss('bootstrap.less');
}
https://github.com/clevertech/YiiBooster/blob/master/widgets/TbGridView.php#L115
Why standart yii::t('zii'...
replaced by yii::t('booster'?
For example just try to load jquery ui and use TbButtonGroup widget on same page.
The root of this problem that both uses one function declared as $.fn.button
.
Many thanks for publishing YiiBooster.
Below is a code example for a TbTabView or - maybe better - you can change the function normalizeTabs() in your TbTabs component so that it can be used as a replacement for a CTabView too.
Yii::import('bootstrap.widgets.TbTabs');
class TbTabView extends TbTabs
{
public $viewData; //new property
/**
* Normalizes the tab configuration.
* @param array $tabs the tab configuration
* @param array $panes a reference to the panes array
* @param integer $i the current index
* @return array the items
*/
protected function normalizeTabs($tabs, &$panes, &$i = 0)
{
$id = $this->getId();
$items = array();
//---------------- new -------------------
//Check if has an active item
$hasActiveItem = false;
foreach ($tabs as $tab)
{
$hasActiveItem = isset($tab['active']) ? $tab['active'] : false;
if($hasActiveItem)
break;
}
//---------------- end new -------------------
foreach ($tabs as $tab)
{
$item = $tab;
if (isset($item['visible']) && $item['visible'] === false)
continue;
//---------------- new -------------------
//check first active
if(!$hasActiveItem && $i == 0)
$item['active'] = true;
//title -> label
if (isset($item['title']))
{
if(!isset($item['label']))
$item['label'] = $item['title'];
unset($item['title']);
}
//------ end new ----------------
if (!isset($item['itemOptions']))
$item['itemOptions'] = array();
$item['linkOptions']['data-toggle'] = 'tab';
if (isset($tab['items']))
$item['items'] = $this->normalizeTabs($item['items'], $panes, $i);
else
{
if (!isset($item['id']))
$item['id'] = $id.'_tab_'.($i + 1);
$item['url'] = '#'.$item['id'];
//if (!isset($item['content']))
// $item['content'] = '';
//--------------- new ---------------
if (!isset($item['content']))
{
if (isset($item['view']))
{
if (isset($item['data']))
{
if (is_array($this->viewData))
$data = array_merge($this->viewData, $item['data']);
else
$data = $item['data'];
unset($item['data']);
} else
$data = $this->viewData;
$item['content'] = $this->getController()->renderPartial($item['view'], $data, true);
unset($item['view']);
}
else
$item['content'] = '';
}
//--------------- end new ---------------
$content = $item['content'];
unset($item['content']);
if (!isset($item['paneOptions']))
$item['paneOptions'] = array();
$paneOptions = $item['paneOptions'];
unset($item['paneOptions']);
$paneOptions['id'] = $item['id'];
$classes = array('tab-pane fade');
if (isset($item['active']) && $item['active'])
$classes[] = 'active in';
$classes = implode(' ', $classes);
if (isset($paneOptions['class']))
$paneOptions['class'] .= ' '.$classes;
else
$paneOptions['class'] = $classes;
$panes[] = CHtml::tag('div', $paneOptions, $content);
$i++; // increment the tab-index
}
$items[] = $item;
}
return $items;
}
}
When working with fixed headers, Filters do not work as expected. Script requires refactoring.
TbJEditableColumn item becomes editable only by double click (in my project 'event' is set to 'click', not to 'doubleclick'). Google Chrome, Win 7
Fixed by myself, probably an error in TbJEditableColumn.php on line 99, there: "$this->event = (!isset($this->jEditableOptions['event'])) ? $this->jEditableOptions['event'] : 'click';", has to be: "$this->event = (isset($this->jEditableOptions['event'])) ? $this->jEditableOptions['event'] : 'click';"
i'd like another option for a table. it should not use the action icons to the right, and the only action that can be performed on a row is clicking to go to some defined page for that row.
the table should be striped and have a hover style when the cursor is over the row.
i'm not sure how to give this to you, but this is what i imagined - https://github.com/tstapleton/YiiBooster/commit/e6a7409192f2dcf213e21011612209b400b8739d
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.