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

Jump to content

  • (45 Pages)
  • +
  • « First
  • 23
  • 24
  • 25
  • 26
  • 27
  • 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

#481 User is offline   zEOn 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 11-October 11

Posted 14 June 2012 - 05:08 AM

Quote

View PostDon Felipe, on 14 June 2012 - 04:58 AM, said:

Some call it magic... well it's quite easy...

'content'=>$this->widget('bootstrap.widgets.BootDetailView', array(
    'data'=>array('id'=>1, 'firstName'=>'Mark', 'lastName'=>'Otto', 'language'=>'CSS'),
    'attributes'=>array(
        array('name'=>'firstName', 'label'=>'First name'),
        array('name'=>'lastName', 'label'=>'Last name'),
        array('name'=>'language', 'label'=>'Language'),
    ),
), true),


$this->widget(widgetName, dataArray)
... writes the output directly to the page because the default of the 3rd parameter is false.

$this->widget(widgetName, dataArray, true)
... "captures" the output and returns it as String object.

Here is the class reference.

...

You can also make use of renderPartial() for long content that needs a lot of additional php code and stuff...

'content'=>$this->renderPartial('filename', array(), true, false),

Put all code/content in 'filename.php' pass variables in array() as usual. With some clever logic you could have only 1 extra file for all the tabs' contents.

Yii-Haw!


Great it works!! Thanks a million Don! You've made my day :)
Will definitely put the latter trick in mind, seems really helpful.

Andy


Hi There,

Got another question here, what if I wanna render image inside (HTMLs) inside the BootDetailView how do I do that?

'content'=>$this->widget('bootstrap.widgets.BootDetailView', array(
    'data'=>array('id'=>1, 'firstName'=>'Mark', 'lastName'=>'Otto', 'imageLink'=>'h t tp://xxx.xxx.com/images/xxx.jpg'),
    'attributes'=>array(
        array('name'=>'firstName', 'label'=>'First name'),
        array('name'=>'lastName', 'label'=>'Last name'),
        array('name'=>'imageLink', 'label'=>'Profile picture'),
    ),
), true),


Current config (true) will render the output as strings so the output looks like :

First name: Mark 
Last name: Otto 
Profile picture: ht tp://xxx.xxx.com/images/xxx.jpg


instead of

First name: Mark 
Last name: Otto 
Profile picture: [Picture]


Does anyone know how to go about doing this?

Andy
0

#482 User is offline   YurkaTim 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 18-June 12

Posted 22 June 2012 - 04:08 AM

Hi All!
I'm trying to use the great extension and stuck attempting to add Ajax functionality to BootMenu.
Just wanted to replace dropDownList for BootMenu and .... no luck.
Does Bootmenu support something similar to:
CHtml::dropDownList($model,'id',$data,
array(
	'ajax'=>array(
	'type'=>'POST',
	'url'=>'some_url', 
	'data'=>array('id'=>'js:this.value'), 
	),
)
);


Any ideas? Maybe there is a way to achieve this with JQuery ?
Thanks in advance.
0

#483 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 22 June 2012 - 05:07 AM

I believe BootListView have a syntax problem when you add 'afterAjaxUpdate' to options.
One that does not occure with CListView.
0

#484 User is offline   YurkaTim 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 18-June 12

Posted 22 June 2012 - 09:03 AM

Sampa, thanks for reply.
It looks like BootMenu extends Cmenu that is not supporting any ajax options for its items at all.
So, I still have no idea about how to make the BootMenu items Ajax compatible :)
0

#485 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 23 June 2012 - 04:42 AM

View PostYurkaTim, on 22 June 2012 - 09:03 AM, said:

Sampa, thanks for reply.
It looks like BootMenu extends Cmenu that is not supporting any ajax options for its items at all.
So, I still have no idea about how to make the BootMenu items Ajax compatible :)


Oh I wasnt responding to you I was reporting a random error I came across :P

But okey, your dropdownlist is nothing other then a normal dropdownlist.. generated thrue php:p

So u can do same things as if u were using another framework etc.

if your model is named Foo then at bottom

<script type="text/javascript">
$("#Foo_id").change(function(){
 $.ajax.....//any js code.
});

0

#486 User is offline   DarKDinDoN 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 23-November 11

Posted 23 June 2012 - 03:13 PM

Hello,

Someone know how I can manually open an alert ? After an ajax request for example.

Thanks :)
0

#487 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 23 June 2012 - 10:27 PM

View PostDarKDinDoN, on 23 June 2012 - 03:13 PM, said:

Hello,

Someone know how I can manually open an alert ? After an ajax request for example.

Thanks :)


Try something like this...

user()->setFlash('error', 'your error message');
$this->widget('bootstrap.widgets.BootAlert', array(
    'htmlOptions'=>array('id'=>'myAlert', 'style'=>'display:none;'),
));


Then in your ajax callback, you show or fade in the alert:
$('#myAlert').show();


Not sure if there's another way to achieve this.
0

#488 User is offline   ekerazha 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 526
  • Joined: 10-October 08
  • Location:European Union

Posted 24 June 2012 - 04:21 AM

Bootstrap uses Glyphicons Free.

The demo page infringes the Glyphicons Free license because it doesn't "add a link to glyphicons.com in a prominent place (e.g. the footer of a website), include the CC-BY license and the reference to glyphicons.com on every page using Glyphicons"

See: http://glyphicons.co...icons-licenses/
Yii user #37
0

#489 User is offline   pompey_pete 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 13-December 11

Posted 26 June 2012 - 07:10 AM

Hi guys, I was wondering if anyone had a neat way to auto-close alerts (the flash messages) after, say, 10 seconds?
0

#490 User is offline   micz 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 31
  • Joined: 05-June 09

Posted 28 June 2012 - 06:30 AM

I have problem with widgets it looks like jquery do not work. Dorpdowns do not drop, slider is a list and so on.
a("body").on is not a function
[Wstrzymuj na tym błędzie] 	

...entTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.opt...

bootstrap.mini.js line 6


now i get
jQuery("a[rel=\"tooltip\"]").tooltip is not a function

jQuery('a[rel="tooltip"]').tooltip();


OK i have commented line 132 and 133 in Bootstrap.php and now it is working but it is temporary solution. I would really appreciate if someone could tell me what can cause this problems.

		//$this->registerTooltip();
		//$this->registerPopover();

0

#491 User is offline   Dyp2000 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 16-March 12

Posted 29 June 2012 - 10:20 PM

Hi!
Animation not working on the carousel. How do I fix it?
On your demo site does not work either.
0

#492 User is offline   zEOn 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 11-October 11

Posted 29 June 2012 - 11:13 PM

Quote

View PostDon Felipe, on 14 June 2012 - 04:58 AM, said:

Some call it magic... well it's quite easy...

'content'=>$this->widget('bootstrap.widgets.BootDetailView', array(
    'data'=>array('id'=>1, 'firstName'=>'Mark', 'lastName'=>'Otto', 'language'=>'CSS'),
    'attributes'=>array(
        array('name'=>'firstName', 'label'=>'First name'),
        array('name'=>'lastName', 'label'=>'Last name'),
        array('name'=>'language', 'label'=>'Language'),
    ),
), true),


$this->widget(widgetName, dataArray)
... writes the output directly to the page because the default of the 3rd parameter is false.

$this->widget(widgetName, dataArray, true)
... "captures" the output and returns it as String object.

Here is the class reference.

...

You can also make use of renderPartial() for long content that needs a lot of additional php code and stuff...

'content'=>$this->renderPartial('filename', array(), true, false),

Put all code/content in 'filename.php' pass variables in array() as usual. With some clever logic you could have only 1 extra file for all the tabs' contents.

Yii-Haw!


Great it works!! Thanks a million Don! You've made my day :)
Will definitely put the latter trick in mind, seems really helpful.

Andy


Hi There,

Got another question here, what if I wanna render image inside (HTMLs) inside the BootDetailView how do I do that?

'content'=>$this->widget('bootstrap.widgets.BootDetailView', array(
    'data'=>array('id'=>1, 'firstName'=>'Mark', 'lastName'=>'Otto', 'imageLink'=>'h t tp://xxx.xxx.com/images/xxx.jpg'),
    'attributes'=>array(
        array('name'=>'firstName', 'label'=>'First name'),
        array('name'=>'lastName', 'label'=>'Last name'),
        array('name'=>'imageLink', 'label'=>'Profile picture'),
    ),
), true),


Current config (true) will render the output as strings so the output looks like :

First name: Mark 
Last name: Otto 
Profile picture: ht tp://xxx.xxx.com/images/xxx.jpg


instead of

First name: Mark 
Last name: Otto 
Profile picture: [Picture]


Does anyone know how to go about doing this?

Andy
0

#493 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 30 June 2012 - 11:34 PM

View PostzEOn, on 29 June 2012 - 11:13 PM, said:

Hi There,

Got another question here, what if I wanna render image inside (HTMLs) inside the BootDetailView how do I do that?

'content'=>$this->widget('bootstrap.widgets.BootDetailView', array(
    'data'=>array('id'=>1, 'firstName'=>'Mark', 'lastName'=>'Otto', 'imageLink'=>'h t tp://xxx.xxx.com/images/xxx.jpg'),
    'attributes'=>array(
        array('name'=>'firstName', 'label'=>'First name'),
        array('name'=>'lastName', 'label'=>'Last name'),
        array('name'=>'imageLink', 'label'=>'Profile picture'),
    ),
), true),


Current config (true) will render the output as strings so the output looks like :

First name: Mark 
Last name: Otto 
Profile picture: ht tp://xxx.xxx.com/images/xxx.jpg


instead of

First name: Mark 
Last name: Otto 
Profile picture: [Picture]


Does anyone know how to go about doing this?

Andy



There's always another question. Please make yourself familiar with the Yii class reference. All the answers are there! Yii-Bootstrap widgets extend the original Yii widgets hence you can make use of all the original options, too.

BootDetailView extends CDetailView - API is here. What needs to be done to have a link inside the view is the same that needs to be done to display an image.

In data simply add CHtml::image(src, alt, htmlOptions) and then you need to define the image attribute to be of type raw. If you need the image as link, put the CHtml::image() inside CHtml::link(). Using the old-fashioned way to render the widget:

$this->widget('bootstrap.widgets.BootDetailView', array(
    'data'=>array(
        'id'=>1, 
        'firstName'=>'Mark', 
        'lastName'=>'Otto', 
        'imageLink'=>CHtml::image(
            'http://www.placehold.it/200x100&text=yii-haw!', 
            'alt', 
            array('width'=>50, 'class'=>'className')
        )
    ),
    'attributes'=>array(
        array('name'=>'firstName', 'label'=>'First name'),
        array('name'=>'lastName', 'label'=>'Last name'),
        array('name'=>'imageLink', 'label'=>'Profile picture', 'type'=>'raw'),
    ),
));


Type raw is available in other widgets eg CGridView, too.

Have fun!
0

#494 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 30 June 2012 - 11:59 PM

View Postmicz, on 28 June 2012 - 06:30 AM, said:

I have problem with widgets it looks like jquery do not work. Dorpdowns do not drop, slider is a list and so on.
a("body").on is not a function
[Wstrzymuj na tym błędzie] 	

...entTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.opt...

bootstrap.mini.js line 6


now i get
jQuery("a[rel=\"tooltip\"]").tooltip is not a function

jQuery('a[rel="tooltip"]').tooltip();


OK i have commented line 132 and 133 in Bootstrap.php and now it is working but it is temporary solution. I would really appreciate if someone could tell me what can cause this problems.

		//$this->registerTooltip();
		//$this->registerPopover();




This is confusing. So you have commented the lines and then it's working?
That means the functionality comes from another jQuery lib that is included.
Make sure there is no (JS) conflict and you're using jQuery 1.7.1.
0

#495 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 01 July 2012 - 12:07 AM

View Postpompey_pete, on 26 June 2012 - 07:10 AM, said:

Hi guys, I was wondering if anyone had a neat way to auto-close alerts (the flash messages) after, say, 10 seconds?


Well, there was a discussion on Twitter's Bootstrap forum about this and there is no neat way and option to auto-hide any alert hence you need to add this manually. Give the alert object an ID and fade/hide the ID after whatever timeout/delay. If you want to auto-hide all or some alerts use a classname instead.
0

#496 User is offline   renathy 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 82
  • Joined: 05-July 11

Posted 01 July 2012 - 06:06 AM

BootModal not working.

I have created view test.php with the foloowing copy/paste code from example:
<?php $this->beginWidget('bootstrap.widgets.BootModal', array('id'=>'myModal')); ?>
 
<div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h3>Modal header</h3>
</div>
 
<div class="modal-body">
    <p>One fine body...</p>
</div>
 
<div class="modal-footer">
    <?php $this->widget('bootstrap.widgets.BootButton', array(
        'type'=>'primary',
        'label'=>'Save changes',
        'url'=>'#',
        'htmlOptions'=>array('data-dismiss'=>'modal'),
    )); ?>
    <?php $this->widget('bootstrap.widgets.BootButton', array(
        'label'=>'Close',
        'url'=>'#',
        'htmlOptions'=>array('data-dismiss'=>'modal'),
    )); ?>
</div>
 
<?php $this->endWidget(); ?>
<?php $this->widget('bootstrap.widgets.BootButton', array(
    'label'=>'Click me',
    'url'=>'#myModal',
    'type'=>'primary',
    'htmlOptions'=>array('data-toggle'=>'modal'),
)); ?>


I do see a button, but nothing happens when I click on it. I do not see any modal window on button click. I do not know where to look at to fix it.
0

#497 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 645
  • Joined: 29-November 08
  • Location:Paris, France

Posted 01 July 2012 - 10:38 AM

Hi renathy,
I cut/paste your code and it works fine for me. Check that bootstrap-alert.js is loaded in your page. I'm using version 0.9.11.
ciao
B)
0

#498 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 645
  • Joined: 29-November 08
  • Location:Paris, France

Posted 01 July 2012 - 11:26 AM

.. and now tested with latest release : 0.10.1.beta.r254 : your code work fine.

On the other hand, I've found another bug related to the afterAjaxUpdate option for the BootGridView widget. It is the same bug as the one fixed for the BootListView (revision).

ciao
B)
0

#499 User is offline   RG_3GNTW 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 17-November 11

Posted 03 July 2012 - 04:40 AM

Hey, guys!

Maybe I'm doing something wrong, but I cannot load bootstrap.

My config/main.php
'preload'=>array('log', 'bootstrap'),
'components'=>array(
           'bootstrap' => array('class' => 'ext.bootstrap.components.Bootstrap'
	    ),
)


My layout/main.php
<?php if(isset($this->breadcrumbs)):?>
		<?php  $this->widget('bootstrap.widgets.BootBreadcrumbs', array(
			'links'=>$this->breadcrumbs,
		)); ?><!-- breadcrumbs -->
<?php endif?>

Give me a error:
Alias "bootstrap.widgets.BootBreadcrumbs" is invalid. Make sure it points to an existing directory or file. 


And don't load css and js.
0

#500 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 645
  • Joined: 29-November 08
  • Location:Paris, France

Posted 03 July 2012 - 01:58 PM

Hi,
your code works fine on my sample app...Did you install 'bootstrap' into your extensions folder ? ... just in case, note that 'boostrap' folder should be lower case.

With version 0.10.1-beta.r254 You should have following folder structure :

protected\extensions\bootstrap
     				+-----assets
         			+-----components
         			+-----lib
         			+-----gii
         			+-----widgets


You could also try to write :

$this->widget('ext.bootstrap.widgets.BootBreadcrumbs', array(
	'links'=>array('Library'=>'#', 'Data'),
));


hope this helps...
B)
0

Share this topic:


  • (45 Pages)
  • +
  • « First
  • 23
  • 24
  • 25
  • 26
  • 27
  • 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