Yiibooster

Ok… i will try to use some trick for my problem… thank you very much for your response antonio…

Cheers…

Hi Antonio,

|Great extension. I am having some issues with the toggle Button. I want to place multiple toggle buttons on teh same row of a form. However when I add


<?php echo $form->toggleButtonRow($model, 'active'); ?>

<?php echo $form->toggleButtonRow($model, 'passive'); ?>

I get the two toggle buttons on individual rows. I have tried using


$form->toggleButton(...)

but it errors with "TbActiveForm and its behaviors do not have a method or closure named toggleButton"

Any ideas?

Thanks

David

Hi Antonio,

great extension! It’s everything that yii-bootstrap has plus so much more. However, now I’m still missing something or I just haven’t found it on your demo site yet.

Is it possible to use the Grid/Chart switcher button (or button group) without the chart but as common ajax buttons to toggle between whatever values? E.g. user list including status, no filter row, use button group to toggle between all/active/inactive users.

I have a manual solution for yii-bootstrap but the button group element is outside the gridview element and I have to use negative margin to display the button right above the grid. So, I’m wondering if there’s an easier way using yii-booster?

Cheers,

Felipe

Another thing. Sorting GridView:

There’s an arrow appearing when hovering on header titles. Is there an option to show the arrow of the column that is used for the current sort order? Besides, is it possible to have the grid sorted by multiple columns as well?

If not, any plans to add this feature in the future?

Thanks, again.

[color="#222222"][font="Arial, sans-serif"][size="2"]Antonio, first of all thank you for your wonderful extension! [/size][/font][/color]

[color="#222222"][font="Arial, sans-serif"] [/font][/color]

[color="#222222"][font="Arial, sans-serif"][size="2"]I have a question for you (or anyone who has the answer), how can I change the language of the TbDateRangePicker according to the language settings of my yii app?[/size][/font][/color]

[color="#222222"][font="Arial, sans-serif"] [/font][/color]

Right now I had to hard code the name of the days in spanish into bootstrap-daterangepicker.js, and the name of the months (that for some reason are not taken from that same file), into date.js. But I need to do this dynamically depending on the language setting of the yii application (English/Spanish). How can I do this?

[color="#222222"][font="Arial, sans-serif"] [/font][/color]

[color="#222222"][font="Arial, sans-serif"][size="2"]I am using the date picker as a filter for a grid like this:[/size][/font][/color]

[color="#222222"][font="Arial, sans-serif"] [/font][/color]

[color="#222222"][font="Arial, sans-serif"][size="2"]




...

 array(

 'name'=>'date_created',

 'filter'=>$this->widget('bootstrap.widgets.TbDateRangePicker', array(

                  'model'=>$model,

                  'attribute'=>'date_created'), 

                  true),

),

...



[/size][/font][/color]

Just a question or observation. If I use the navbar with fixed set to true, the extension adds the wrong(read: non existant) class.

E.g.:

It’s quite easy to fix in the application(just add “navbar-fixed-top” to the htmlOptions array, but a quick look at the sourcecode didn’t reveal where the bug is related to).

Also I think there should be an option to automaticly apply

padding-top: 40px;

to the body tag, if fixed navbar is used.

But still epic extension (also thanks to the original author of yiiBootstrap ;) )

btw. are you planning to ship Bootstrap 2.1.2 as soon as it is released as 2.1.1 is not compatible with any non-js(made it compile on .net with js-context, buts thats not a solution) compiler?

In order to use internationalization for DateRangePicker you will have to provide the locale object to its options, so I recommend you to create a different locale for the different languages you use.

For example, for spanish:




$this->widget('bootstrap.widgets.TbDateRangePicker', array(

                  'model'=>$model,

                  'attribute'=>'date_created',

                  'options'=>array('locale'=>array(

                      'applyLabel'=>'Aplicar',

                      'fromLabel'=>'Desde',

                      'toLabel'=>'Hasta',

                      'customRangeLabel'=>'Personalizado',

                     'daysOfWeek'=>array('Do','Lu','Ma','Mi','Ju','Vi',Sa'),

                     'monthNames'=>array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'),

                     'firstDay'=>1

)), 

                     true,

),



Check bootstrap.daterangepicker.js file in asssets/js folder

Totally, untested!!!

On your first question, is pure CSS… change its behavior: https://github.com/clevertech/YiiBooster/commit/2691715924e094f869b3127bb46d43e5d605be2a

You can also get the bootstrap.yii.css from Yii-Bootstrap extension, replace it and the arrow will be displayed as you wish

Yes!! and I have already done it, and even more… you will be able to actually save the filter for later use! The widget is TbExtendedFilter and will be included in version 1.0.4… Check the attached image for a snapshot on its behavior :)

Please, any suggestions or code refactoring… help us on github!!! please!! :) rise the issues there and I will fix it asap!

About new bootstrap versions… we will update of course… whats the point of being obsolete :) ? We would like some help though!

Provide me with the code and I will help you out!!! Show everything you have done here please (not too long code, just the issue section)

That shouldn’t be a problem Felipe… The toggle button is just the regular widget at the Booster collection… now, the only thing you need to code is the actions of the toggle buttons and then a simple jquery script to handle the grid updates… I have to investigate how to do it a bit further… show me your code and i will try to help as much as i can ‘AMIGO’

is pure CSS… change its behavior: https://github.com/clevertech/YiiBooster/commit/2691715924e094f869b3127bb46d43e5d605be2a

You can also get the bootstrap.yii.css from Yii-Bootstrap extension, replace it and the arrow will be displayed as you wish

I am planning to support both methods instead of being automatic

New version of YiiBooster is out: current is 1.0.3

Thank you for the reply!

I have some comments:

  1. monthNames does not take effect. not even hard coding the months in bootstrap.daterangepicker.js. I believe this is a bug. The month names are being taken from date.js. I wish I could help solving this bug but I am not good at all in javascript.

  2. now I understand how to pass the locale object when declaring the widget, but how can I use different locale objects depending on the "language" variable of my config/main.php file?

Thank you again.

Edit: I already joined the development of yiibooster in git ;) I started my contribution by putting all the locales for the date.js component. I need some help to complete this because I do not know javascript. I am also new to git or any similar thing. I am finding it amazing.

According to the bootstrap documentation:

"…and remember to account for the hidden area underneath it by adding at least 40px padding to the <body>. Be sure to add this after the core Bootstrap CSS and before the optional responsive CSS."

I dont know if its the best solution, but I had to include the padding at the end of the assets/css/bootstrap.css file (if not the padding breaks with the responsive design).

I dont know how something that automatically adds that padding can be implemented, but yes I agree with you. Every time I add a new version of yii booster to my project I have to go back and modify the bootstrap.css again.

Antonio is right. You SHOULD join the github development. I already did.

You could be right that there is a bug within the plugin. I found my self debugging and fixing lots of them (one of the ‘non-official’ jeditable from jquery had a bunch for example).

About joining, great! do not worry for your pull requests… I will personally check your code and will modify if required (happens with some of them for current version), the best is that you join, share ideas, comments, in order to make it better and better for all of us.

Hi there!

What you think about moving input widgets into static functions as CHtml? This is a major impact on their performance.

Sample:


    public static function label($label,$for,$htmlOptions=array()) {

		if(isset($htmlOptions['class']))

		    $htmlOptions['class'] .= ' control-label';

		else

		    $htmlOptions['class'] = 'control-label';

		return CHtml::label($label, $for, $htmlOptions);

	}



and




echo BootStrap::wrapControl(

		BootStrap::activeLabelEx($model, 'name'),

		BootStrap::activeTextField($model, 'name', 'Enter your name here...')

);






    public static function badge($text = '', $style = self::SIMPLE) {

	if($style != '')

	    $style = ' badge-'.$style;

	return "<span class='badge$style'>$text</span>";

    }



I have already implemented a wrapper for the basic functions, but it is hard work for one.

You just named the new helper class I had in mind: TbHtml

After some days of playing with yiibooster I have found that responsive design is great but does not work for grids. It would be awesome to have a responsive grid, something like the one in this page:

http://css-tricks.co.../responsive.php

I do not know if this same trick could work for the yii grid but maybe something similar can be done.

For now, to make the experience of the grids in tablets or phones a little better , I managed to make some columns disappear like this:




...


array(

  'name'=>'date_modified',

  'htmlOptions'=>array('class'=>'hidden-tablet hidden-phone'), 

  'headerHtmlOptions'=>array('class'=>'hidden-tablet hidden-phone'),

 'filterHtmlOptions'=>array('class'=>'hidden-tablet hidden-phone'),

),

...



Maybe someone is wondering why I used "hidden-tablet hidden-phone" instead of "visible-desktop." Well, for some reason if I use the visible-desktop the grid design breaks. The hidden class works OK.

Anyway, this option works for hiding columns but the one I am suggesting would work for having the same columns displayed vertically. Grids are very useful and if someone is using bootstrap it is very probable he/she wants compatibility with all mobile devices, so the responsive gris is a must!

I totally agree with you, could you join to github and make the proposed changes on a pull request. We could include the modified classes on bootstra-yii.css