Yii Framework Forum: [EXTENSION] Bootstrap - Yii Framework Forum

Jump to content

  • (45 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] Bootstrap Bringing together Yii and Twitter Bootstrap Rate Topic: ***** 23 Votes

#21 User is offline   echoo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 18-June 11

Posted 14 October 2011 - 02:46 AM

can't wait features

BootPopOver - A rich content tooltip
BootDialog - Bootstrap dialog


hope will be release soon

thank for wonderful ext.
0

#22 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 217
  • Joined: 26-September 09

Posted 17 October 2011 - 07:34 AM

Hi Chris,

Sorry to put the question on the comment. I did not notice there is a forum thread for bootstrap. It is amazing extension, very easy to use. Documentations and more samples would be great.

My problem is "Close not working on alert message"

I cannot make the close button works, I did this on the main layout

<?php echo Yii::app()->bootstrap->registerBootstrap(); ?>
<?php echo Yii::app()->bootstrap->registerScriptFile("jquery.bootflash.js"); ?>
and on the view file

<?php if (Yii::app()->user->hasFlash('profileMessage')): ?>
<div class="alert-message success fade in" data-alert="alert">
<a class="close" href="#">×</a>
<?php echo Yii::app()->user->getFlash('profileMessage'); ?>
</div>
<?php endif; ?>
Anything else should be added?

Actually, I show a bootFlash widget, is it the same as alert? how to use it?

Cheers,

Daniel
0

#23 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 17 October 2011 - 07:42 AM

View PostDaniel, on 17 October 2011 - 07:34 AM, said:

Hi Chris,

Sorry to put the question on the comment. I did not notice there is a forum thread for bootstrap. It is amazing extension, very easy to use. Documentations and more samples would be great.

My problem is "Close not working on alert message"

I cannot make the close button works, I did this on the main layout

<?php echo Yii::app()->bootstrap->registerBootstrap(); ?>
<?php echo Yii::app()->bootstrap->registerScriptFile("jquery.bootflash.js"); ?>
and on the view file

<?php if (Yii::app()->user->hasFlash('profileMessage')): ?>
<div class="alert-message success fade in" data-alert="alert">
<a class="close" href="#">×</a>
<?php echo Yii::app()->user->getFlash('profileMessage'); ?>
</div>
<?php endif; ?>
Anything else should be added?

Actually, I show a bootFlash widget, is it the same as alert? how to use it?

Cheers,

Daniel


Hey Daniel,

You don't need to register anything else besides Bootstrap itself in your layout. The widgets will register the necessary files themselves. Also, you can register BootFlash by adding the following code to the layout/view where you want to display the flash messages.

<?php $this->widget('ext.bootstrap.widgets.BootFlash'); ?>

If your flash message categories are set to 'success', 'info', 'warning' and 'error' this will display you flash messages. You can also set the keys manually by setting them in the widget configuration array and passing them as the second argument to the widget method.

I hope this helps. Please let me know if there are any future problems.
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#24 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 217
  • Joined: 26-September 09

Posted 18 October 2011 - 07:45 AM

View PostChris83, on 17 October 2011 - 07:42 AM, said:

Hey Daniel,

You don't need to register anything else besides Bootstrap itself in your layout. The widgets will register the necessary files themselves. Also, you can register BootFlash by adding the following code to the layout/view where you want to display the flash messages.

<?php $this->widget('ext.bootstrap.widgets.BootFlash'); ?>

If your flash message categories are set to 'success', 'info', 'warning' and 'error' this will display you flash messages. You can also set the keys manually by setting them in the widget configuration array and passing them as the second argument to the widget method.

I hope this helps. Please let me know if there are any future problems.


Hi Chris,

Thank you very much for your prompt and helpful response. One suggestion, why the flash is automatically closed? Any options to set the flash not closed automatically?

I am thinking of setting like template,

<?php $this->widget('ext.bootstrap.widgets.BootFlash', array('template' => '<div class="alert-message {key}"><p>{message}</p></div>')); ?>


Cheers,

Daniel
0

#25 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 18 October 2011 - 07:56 AM

@Daniel: That's a good suggestion. It could be an option, I'll try to add it to the next release.
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#26 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 20 October 2011 - 06:31 PM

Version 0.9.2 is now live!
http://www.yiiframew...strap-0.9.2.zip

What's new?
  • BootPopover (rich content tooltip widget)
  • Fixed a few bugs in the BootCrumb widget
  • Improved the existing jQuery plugins

I have also added more examples on the extension page, be sure to check them out.

Enjoy!
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#27 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 217
  • Joined: 26-September 09

Posted 21 October 2011 - 06:35 PM

Hi Chris,

Another question, I add the afterDelete action on the CGridView, so that after successful/failed on deletion, it will shows the error message. How could I display using BootFlash?

What I usually have

View
<div id="statusMsg">
    <?php $this->widget('ext.bootstrap.widgets.BootFlash', array('template' => '<div class="alert-message {key}"><p>{message}</p></div>')); ?>
</div>

<?php
$this->widget('ext.bootstrap.widgets.grid.BootGridView', array(
    'id' => 'purchase-order-grid',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'columns' => array(
        ...
        array(
            'class' => 'CButtonColumn',
            'template' => '{delete}',
            'afterDelete' => 'function(link,success,data){ if(success) $("#statusMsg").html(data); }',
        ),
    ),
));


Controller
public function actionDelete($id) {
        // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
        if (Yii::app()->request->isPostRequest) {
            try {
                $model = $this->loadModel($id);
                $model->delete();
                if (!isset($_GET['ajax']))
                    Yii::app()->user->setFlash('success', "PO Number #$model->number has been successfully deleted.");
                else
                    echo "<div class='alert-message success'>PO Number #$model->number has been successfully deleted.</div>";
            } catch (CDbException $e) {
                if (!isset($_GET['ajax']))
                    Yii::app()->user->setFlash('error', "PO Number #$model->number cannot be deleted, Please delete all details first before continue.");
                else
                    echo "<div class='alert-message error'>PO Number #$model->number cannot be deleted, Please delete all details first before continue.</div>"; //for ajax
            }
        }
        else
            throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');

        // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
        if (!isset($_GET['ajax']))
            $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
    }


Thank you for your help.

Regards,

Daniel
0

#28 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 23 October 2011 - 04:51 PM

Version 0.9.3 is now live!
http://www.yiiframew...strap-0.9.3.zip

What's new?
  • BootModal, BootTabs and BootPills
  • Replaced the jQuery plugins with jQuery UI widgets
  • Added support rendering of captcha blocks

I've been working hard with the JavaScript and both the new and existing widgets for this extension so I'm really exited about this release.

Enjoy!
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
1

#29 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 23 October 2011 - 04:56 PM

@Daniel: In version 0.9.3 you can call the bootAlert widgets 'alert' method:

jQuery('#alert').bootAlert('alert','error','Failed to delete order.');

The code above will only work if you set your BootAlert widget's id to 'alert':

<?php $this->widget('ext.bootstrap.widgets.BootAlert',array(
    'id'=>'alert',
)); ?>

Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#30 User is offline   Dr. x 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 26-October 11

Posted 01 November 2011 - 09:51 AM

hello,
nice work Chris. can you please add trigger to popover ? coz i need it to be focus on forum input not just hover on mouse hover.
Best Regards
0

#31 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 03 November 2011 - 06:30 AM

View PostDr. x, on 01 November 2011 - 09:51 AM, said:

hello,
nice work Chris. can you please add trigger to popover ? coz i need it to be focus on forum input not just hover on mouse hover.
Best Regards


Hey Dr. x,

This is already supported. Just set the showEvent/hideEvent options to focus/blur and it should work.
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#32 User is offline   Dr. x 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 26-October 11

Posted 05 November 2011 - 10:14 AM

View PostChris83, on 03 November 2011 - 06:30 AM, said:

Hey Dr. x,

This is already supported. Just set the showEvent/hideEvent options to focus/blur and it should work.


thank you Chris for help , it work
0

#33 User is offline   lightglitch 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 05-January 10

Posted 05 November 2011 - 07:08 PM

Nice work.
Are you going to update to the bootstrap 1.4 ?
0

#34 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 08 November 2011 - 02:39 PM

View Postlightglitch, on 05 November 2011 - 07:08 PM, said:

Nice work.
Are you going to update to the bootstrap 1.4 ?


Yes I will. There will most likely be a new release available this Friday.
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#35 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 217
  • Joined: 26-September 09

Posted 08 November 2011 - 10:14 PM

Hi Chris,

any example to use BootAlert on form validation?

what I can only think is

<?php echo CHtml::errorSummary($model, null, null, array('class' => 'alert-message block-message error')); ?>


but not as expected ;(

Cheers,

Daniel
0

#36 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 217
  • Joined: 26-September 09

Posted 11 November 2011 - 04:47 AM

View PostDaniel, on 08 November 2011 - 10:14 PM, said:

Hi Chris,

any example to use BootAlert on form validation?

what I can only think is

<?php echo CHtml::errorSummary($model, null, null, array('class' => 'alert-message block-message error')); ?>


but not as expected ;(

Cheers,

Daniel


Hi Chris,

Disregard last post since I re-think and it would be unwise to display error message summary as BootAlert. The reason is that the BootAlert will be hidden/closed after some times. Instead, I just set the error message text as "Failed on ......" as the information and let the error for each attribute shown next to the textfield

$form = $this->beginWidget('ext.bootstrap.widgets.BootActiveForm', array(
    ...
    'errorMessageType' => 'inline', // how to display errors, inline or block?
    ...


Next question,

In my situation, I put the BootAlert on the layout/main.php. Hence, global position for error message. And below is my view admin.php code which contains afterDelete on the CGridView

$this->widget('ext.bootstrap.widgets.grid.BootGridView', array(
        ...
        array(
            'class' => 'CButtonColumn',
            'template' => '{delete}',
            'afterDelete' => "function(link,success,data){ if(success) { var obj = jQuery.parseJSON(data); jQuery('#alert').bootAlert('alert', obj.status, obj.msg); } }",
        ),


As your instruction on the previous message I can display the error message upon ajax call. BootAlert is displayed as expected. However, one thing that is annoy me a little bit. The BootAlert is not closed automatically. I need to press on "X" to close the error message. If not closed, it will stack to each other.

Any help on this?

Cheers,

Daniel
0

#37 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 14 November 2011 - 02:16 AM

Version 0.9.4 is now live!
http://www.yiiframew...strap-0.9.4.zip

What's new?
  • Updated to Bootstrap 1.4.0

Sorry for the delay, I've been very busy lately.

Enjoy!
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#38 User is offline   Termine 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 18-October 11

Posted 22 November 2011 - 09:56 AM

Just have to say that this extension is amazing and having just got the flash message set up and running I am blown away. I was in the process of putting a similar set of css/tools together when I found your extension.

Thanks You!!
0

#39 User is offline   lightglitch 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 05-January 10

Posted 23 November 2011 - 08:48 AM

View PostChris83, on 14 November 2011 - 02:16 AM, said:

Version 0.9.4 is now live!
http://www.yiiframew...strap-0.9.4.zip

What's new?
  • Updated to Bootstrap 1.4.0

Sorry for the delay, I've been very busy lately.

Enjoy!


Nice, thanks a lot.
0

#40 User is offline   Bruno Piaui 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 18-October 10

Posted 27 November 2011 - 12:10 PM

Good afternoon gentlemen,

I am using the bootstrap extension and I can not make the button to open a modal screen work. How to close the screen.

The following code:

<a id="linkContatos" class="btn" data-controls-modal="dialogoContato" data-backdrop="true" data-keyboard="true" >Inserir novo contato</a>
                    </div>

                    <?php
                            $this->beginWidget('ext.bootstrap.widgets.BootModal',array(
                                    'id'=>'dialogoContato',
                                    'options'=>array(
                                            'title'=>'Inserir um novo contato',
                                            'backdropClose'=>false,
                                            'escapeClose'=>false,
                                            'open'=>true,
                                            //'closeTime'=>350,
                                            //'openTime'=>1000,
                                            'buttons'=>array(
                                                    array(
                                                            'label'=>'Salvar Contato',
                                                            'class'=>'btn primary',
                                                            'click'=>'js:salvarContato',
                                                    ),
                                                    array(
                                                            'label'=>'Cancelar',
                                                            'class'=>'btn primary',
                                                            'click'=>'js:function(){ $(this).modal("hide");}',
                                                    ),
                                            ),     
                                    ),
                            ));
                    ?>       
                    <div>
                            <?php echo $this->renderPartial('../contatos/_form_clientes', array('model'=>new Contatos)); ?>
                    </div>
                    <?php $this->endWidget(); ?>


I know qa modal screen is working since I left open automatically. The only problem is the buttons to open and close work right.

Thanks,
Bruno Piaui

ps: I'm sorry "English". I am Brazilian and I'm using google translation ;D
0

Share this topic:


  • (45 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users