Code Monkey home page Code Monkey logo

yiibooster's Introduction

YiiBooster

Gitter

Travis CI Scrutinizer Code Quality Code Coverage SensioLabsInsight

Latest Stable Version Latest Unstable Version Total Downloads License

YiiBooster is a widget toolkit for Yii web framework. Its main purpose is to ease building UI in Yii-based web applications utilizing the beauty of Twitter Bootstrap and several other great UI plugins developed over time by the community.

Twitter Bootstrap wrapping is based over the excellent job of Christoffer Niska called Yii-Bootstrap. We at Clevertech included his library into our own Yii project startup library, YiiBoilerplate, and started improving it in order to satisfy some of our customers' project requirements. YiiBooster is an end result of this effort.

We tried very hard in past to accommodate to radical changes between successive versions of Twitter Bootstrap, but starting from November 2016 we will just follow the latest stable version published by Twitter. This means that when you upgrade YiiBooster, you upgrade Twitter Bootstrap as well.

Widgets at a glance

Overall, the following is included in YiiBooster:

Quick Start

If you want, you can clone the github repo and get the full codebase to build the distributive or documentation or just to hack something.

If you just want to use YiiBooster, you need to download the latest distributive archive. After that, consult the YiiBooster documentation website or the INSTALL.md file included in the package.

Widgets end-user documentation

Check out YiiBooster documentation website.

Contributing

Long story short: make pull requests from separate branches dedicated for individual features to master. Please see the wiki page about how to contribute to YiiBooster for details.

Requirements

YiiBooster as a project requires (and supports) PHP 5.3 and Yii 1.1.15.

We know that PHP 5.3 is deprecated for several years already and Yii has version 2 released a year ago. A major overwrite is planned, but as for YiiBooster as it is, the dependencies versions stand as they are.

For development we specify explicitly that you'll need PHPUnit 4.8, because it's the last version to support PHP 5.3.

Bug tracker

If you find any bugs, please create an issue at issue tracker for project Github repository.

License

This work as a whole is licensed under a BSD license. Full text is included in the LICENSE file in the root of codebase.

Well-built beautifully designed web applications.

www.clevertech.biz

yiibooster's People

Contributors

adeg avatar alegzander avatar amrbedair avatar donfelipe avatar dragnet avatar fleuryc avatar gerthelsen avatar gureedo avatar hijarian avatar hrumpa avatar ianare avatar jamesmbowler avatar kazuo avatar kullarkert avatar kurounin avatar lisps avatar magefad avatar marsuboss avatar miramir avatar naduvko avatar pappfer avatar realtebo avatar sauloonze avatar soee avatar tyvik avatar vitalets avatar wkii avatar xpoft avatar yasen avatar zhandoskz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yiibooster's Issues

TbRelationalColumn Enhancement

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

TbDateRangePicker i18n

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.

Support for HTML5 form types in htmlOptions

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)

TbTabView / TbTabs

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;
    }

}

Grid Sortable Rows - position afterSort & current page number

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?

feature request : need support the formBuilder functionality of yii

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 

Many-to-many support for TbActiveForm

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

TbDatePicker conflicts with jQueryUI

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.

TBBox Actions - ButtonGroup Options to Pass

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

JS in TbTabs

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!

Missing top padding in radioButtonListRow and checkBoxListRow

There is a missing top padding in radioButtonListRow and checkBoxListRow. In generation of radioButtonListRow or checkBoxListRow yii adds hidden field first after

and css style

.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;
}

TbJEditableColumn - adjusting width on input or min-width

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.

Highcharts JS Licence

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.

TbTabs ajax

Do you plan to add ajax feature in TbTabs like in CJuiTabs ?

bug ie modal IE 8

If render modal in TbBox then there is a shadow in the browser IE 8
.bootstrap-widget { position: relative; ?????}

buttongroup ui error with dropdown

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

Using Less

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');
}

Extendended Summary only allows one summary of each type

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.

Editable not working on click

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';"

error in TbDataColumn

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

Incomplete class is added to fixed navbar

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-1instead of navbar-fixed-top or navbar-fixed-bottom.

To fix this I added navbar-fixed-topby hand. (See commented line above).

Variable number of input widget fields not working

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/

Redactor Js License

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.

Modal error (Resuelto)

Cuando creamos un botón con ventana modal si lo usas desde móvil no aparece la ventana.

TbToggleColumn not beautiful view in grid

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? :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.