[EXTENSION] Bootstrap

+1

@saska, Dyp2000: I’m not sure I understand what you mean… What do you mean by items? Dropdown?

I’ve released a BETA version of the upcoming version 0.9.11.

What’s new?

  • Added BootLabel, BootBadge

  • BootTabbable improvements

  • BootButton, BootButtonGroup improvements

  • BootNavbar, BootMenu improvements

  • BootGridView, BootDetailView improvements

  • Fixed BootTabbable events

  • Added missing CSS for Yii components

  • Renamed BootButton::fn to buttonType (changed to be more Yii:ish, sorry for the inconvenience)

I was going to release version 1.0.0 next but it will be a bit delayed because I’ve been quite busy. However, many people has asked about the next release so I thought it would be good to do a release now.

You can download it here:

http://www.yiiframework.com/ext/files/?id=642

Enjoy!

I want make confirmation dialog for item links inside drop down menu, i try make this:

<?php $this->widget('bootstrap.widgets.BootButtonGroup', array(


    'type'=>'primary',


    'buttons'=>array(


        array('label'=>'Edit', 'url'=>array('update', 'id'=>$data->id)),


        array('items'=>array(


            array(


            	'label'=>'Deleteee1',


            	'url'=>array(


            		'item/delete',


            		'id'=>$data->id,


            	),


            	'htmlOptions'=>array(


                    	'submit'=>array('item/delete', 'id'=>$data->id), 


                    	'confirm'=>'Are you sure?',


            	),


            ),


        )),


    ),


)); ?>

but this not work, becouse Object BootButtonGroup not have reciedev properties ‘htmlOptions’ inside items.

I attach screenshot with link "Delete" wich need confirmation dialog.

Hope i make clearly this explain.

I’m beginning with Yii starting yesterday. Can someone post the complete source code (view and controller) of the demo including the PHP and HTML files if any incl View and Controllers. I’m finding it very hard to understand how this extension will be used.

Quite naively maybe, if I put the following in a .php file and run it in a browser I get,

[font="Courier New"]Fatal error: Using $this when not in object context in C:\Tools\xampp\htdocs\learning\testBS.php on line 1[/font]


<?php $form=$this->beginWidget('ext.bootstrap.widgets.BootActiveForm',array(

        'id'=>'contatos-form',

        'stacked'=>true,

        'enableAjaxValidation'=>false,

)); ?>

<div class="hidden">

        <?php echo $form->textFieldRow($model,'id',array('class'=>'span5')); ?>


        <?php echo $form->textFieldRow($model,'data_cri',array('class'=>'span5')); ?>


        <?php echo $form->textFieldRow($model,'data_alt',array('class'=>'span5')); ?>


        <?php echo $form->textFieldRow($model,'criado_por',array('class'=>'span5','maxlength'=>20)); ?>


        <?php echo $form->textFieldRow($model,'alterado_por',array('class'=>'span5','maxlength'=>20)); ?>


        <?php echo $form->textFieldRow($model,'id_cliente',array('class'=>'span5')); ?>

</div>


        <?php echo $form->dropDownListRow($model,'tipo',array('Residencial'=>'Residencial', 'Comercial'=>'Comercial', 'Celular'=>'Celular', 'Rádio'=>'Rádio'),array('class'=>'span5','maxlength'=>30)); ?>


        <?php echo $form->textFieldRow($model,'ddd',array('class'=>'span5')); ?>


        <?php echo $form->textFieldRow($model,'numero',array('class'=>'span5')); ?>


<?php $this->endWidget(); ?>

Alright saska,

Here’s the solution:




<?php $this->widget('bootstrap.widgets.BootButtonGroup', array(

	'type'=>'primary',

	'buttons'=>array(

		array('label'=>'Edit', 'url'=>array('update', 'id'=>1)),

		array('items'=>array(

			array('label'=>'Delete', 'url'=>'#', 'linkOptions'=>array(

				'submit'=>array('item/delete', 'id'=>1),

				'confirm'=>'Are you sure?')

			),

		)),

	),

)); ?>



The problem was that you tried specifying htmlOptions for the dropdown link when infact itemOptions are the htmlOptions for the list item (li) and linkOptions are the htmlOptions for the link itself. Hope this helps, it worked for me at least.

Thank you!

Hey Coowboy,

Seems that you haven’t set up your Yii application properly. Please read the guides to learn Yii basics before you try to install any extensions.

I’d recommend you start by reading this:

The Definitive Guide to Yii

Chris83 - Thanks for the prompt reply. I have indeed setup Yii, created my first app and am able to do the first set of usual things as laid out in the guide. Would it be possible for you to zip up and provide the demo project including the app configuration files?

hi Chris

i already extracted to extensions

and css not reload

mysterious!!!

Of course you also need to add bootstrap to your application config. You can read about setting up the extension here:

http://www.cniska.net/yii-bootstrap/setup.html

Hi,

i followed the setup instructions at cniska.net/yii-bootstrap/setup.html (and added ‘generatorPaths’=>array(‘bootstrap.gii’), to config/main.php)

Using


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

works well, but when I use gii to generate CRUD code, it still generates the normal code (e.g. admin.php still contains zii.widgets.grid.CGridView) instead of the code provided in extensions/bootstrap/gii/bootstrap/templates/default/.

Any idea whats wrong?

Latest version of yii, yii-bootstrap 0.9.11 beta.

Ok…my fault. Just saw that the bootstrap-CRUD-generator will not replace the yii-CRUD-generator. Used the "Bootstrap Generator" and everything works fine.

How to set the carousel to auto rotate once the page is loaded


'events'=>array(

                    'slide'=>"js:function() { console.log('Carousel slide.'); }",

                    'slid'=>"js:function() { console.log('Carousel slid.'); }",

                ),

Please add the code to BootCarousel.php to draw custom html code. Like this:


protected function renderItems ($items)

....

if (isset($item['customHtml'])) {

    echo $item['customHtml'];

}

...

}

for autorotate carousel and correct handle ‘options’ do patch BootCarousel.php - public function run():

replace this


$cs->registerScript(__CLASS__.'#'.$id, "jQuery('{$id}').carousel({$options});");

to


$cs->registerScript(__CLASS__.'#'.$this->id, "jQuery('#{$id}').carousel({$options});");

Great extension!!!

When I loaded the bootstrapper, my existing forms were transformed to the css of the bootstrap.

I don’t really want that, it is possible to only apply the css to forms I indicate?

Hi ! This is really great extension, although icons in submit button doesn’t work for me.


<?php $this->widget('bootstrap.widgets.BootButton', array('fn'=>'submit', 'type'=>'primary', 'icon'=>'ok white', 'label'=>'Submit')); ?>

Result:


<input class="btn btn-primary" type="submit" name="yt1" value="&lt;i class=&quot;icon-ok icon-white&quot;&gt;&lt;/i&gt; Submit">

I tried the extension, but in my case it seems to be very slow. I attach a screenshot. Maybe somebody of you can tell me why it tooks about 5-6 seconds to load each page. This is just a period which is not accepted by my users. Maybe it is a misconfiguration of my server.

Thx

Zebra :slight_smile:

http://twitter.github.com/bootstrap/base-css.html#icons