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

Jump to content

  • (45 Pages)
  • +
  • « First
  • 20
  • 21
  • 22
  • 23
  • 24
  • 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

#421 User is offline   Don Felipe 

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

Posted 09 May 2012 - 11:59 PM

View Postjmariani, on 09 May 2012 - 08:35 AM, said:

1) How to remove the 'X' (close) from the alert?
2) Hot to add a icon to the alert?

Also: BootNavBar: How to change the bar's color?


1) Many ways to accomplish this. To omit the "X" for all alerts add this to your stylesheet:
.alert-block a.close {
    display:none;
}

If you want to omit the "X" for a certain alert only while still visible for all the other alerts, add a class...
<?php 		
    user()->setFlash('info', 'your alert message');
    $this->widget('bootstrap.widgets.BootAlert', array(
        'htmlOptions'=>array('class'=>'alertWithoutX')
    ));
?>

...and replace the ".alert-block" with the new classname:
.alertWithoutX a.close {
    display:none;
}


2) Like adding one of the bootstrap-icons to the alert message? (remove the "icon-white" for black icon)
<?php 		
    user()->setFlash('info', '<i class="icon-info-sign icon-white"></i> alert with a fancy icon!');
    [...]
?>


BootNavbar: Simply add this to your stylesheet:
.navbar-inner {
    background-color: #424242;
    background-image: none; 
}

0

#422 User is offline   NCS_One 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 24-August 11

Posted 11 May 2012 - 12:12 AM

Hi,

Am I doing something wrong or when a model with errors is rendered the validation errors are showed but not in red (this because the error class is not added)?
0

#423 User is offline   NCS_One 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 24-August 11

Posted 11 May 2012 - 01:02 AM

Ok found the problem.

To find if attribute has errors you don't use the input name but the attribute name.

On BootInput.php line 262, change this:
if ($this->model->hasErrors(CHtml::resolveName($this->model, $this->attribute)))

to:
if ($this->model->hasErrors($this->attribute))

0

#424 User is offline   giantdut 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 24-April 12
  • Location:Jakarta, Indonesia

Posted 12 May 2012 - 01:38 PM

Hello I'm new...

i want to add html attribute at bootstrap.widgets.BootMenu

<a href="#">
<i class="icon-cog"></i>
Create New
</a>

to be

<a href="#" id="click">
<i class="icon-cog"></i>
Create New
</a>

can anyone help me?

because google just give me this forum at first page when i search "How to add html attribute on bootstrap.widgets.BootMenu"

Sorry if my question very newbie :)

Thanks
Try to explore my intellectual capital
0

#425 User is offline   NCS_One 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 24-August 11

Posted 12 May 2012 - 01:53 PM

View Postgiantdut, on 12 May 2012 - 01:38 PM, said:

Hello I'm new...

i want to add html attribute at bootstrap.widgets.BootMenu

<a href="#">
<i class="icon-cog"></i>
Create New
</a>

to be

<a href="#" id="click">
<i class="icon-cog"></i>
Create New
</a>

can anyone help me?

because google just give me this forum at first page when i search "How to add html attribute on bootstrap.widgets.BootMenu"

Sorry if my question very newbie :)

Thanks


Hi,

Look at last item:

<?php $this->widget('bootstrap.widgets.BootMenu', array(
    'type'=>'list',
    'items'=>array(
        array('label'=>'LIST HEADER', ),
        array('label'=>'Home', 'icon'=>'home', 'url'=>'#', 'active'=>true),
        array('label'=>'Library', 'icon'=>'book', 'url'=>'#'),
        array('label'=>'Application', 'icon'=>'pencil', 'url'=>'#'),
        array('label'=>'ANOTHER LIST HEADER'),
        array('label'=>'Profile', 'icon'=>'user', 'url'=>'#'),
        array('label'=>'Settings', 'icon'=>'cog', 'url'=>'#'),
        array('label'=>'Help', 'icon'=>'flag', 'url'=>'#', 'linkOptions'=>array('id'=>'click')),
    ),
)); ?>

0

#426 User is offline   giantdut 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 24-April 12
  • Location:Jakarta, Indonesia

Posted 12 May 2012 - 02:14 PM

View PostNCS_One, on 12 May 2012 - 01:53 PM, said:

Hi,

Look at last item:

<?php $this->widget('bootstrap.widgets.BootMenu', array(
    'type'=>'list',
    'items'=>array(
        array('label'=>'LIST HEADER', ),
        array('label'=>'Home', 'icon'=>'home', 'url'=>'#', 'active'=>true),
        array('label'=>'Library', 'icon'=>'book', 'url'=>'#'),
        array('label'=>'Application', 'icon'=>'pencil', 'url'=>'#'),
        array('label'=>'ANOTHER LIST HEADER'),
        array('label'=>'Profile', 'icon'=>'user', 'url'=>'#'),
        array('label'=>'Settings', 'icon'=>'cog', 'url'=>'#'),
        array('label'=>'Help', 'icon'=>'flag', 'url'=>'#', 'linkOptions'=>array('id'=>'click')),
    ),
)); ?>



Tq tq... it's work...

btw where i can get the documentation of any option for modified bootstrap extension. hmm any simple modification like my question actually :)
Try to explore my intellectual capital
0

#427 User is offline   NCS_One 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 24-August 11

Posted 12 May 2012 - 04:23 PM

View Postgiantdut, on 12 May 2012 - 02:14 PM, said:

Tq tq... it's work...

btw where i can get the documentation of any option for modified bootstrap extension. hmm any simple modification like my question actually :)


I look at the source code :)
0

#428 User is offline   giantdut 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 24-April 12
  • Location:Jakarta, Indonesia

Posted 14 May 2012 - 12:57 AM

Hello...

how to change background color for nav bar?

I try to override class navbar inner, but it is still not worked :(

I want to change to #443266, can i still get gradient color?
Try to explore my intellectual capital
0

#429 User is offline   Don Felipe 

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

Posted 14 May 2012 - 01:31 AM

View Postgiantdut, on 14 May 2012 - 12:57 AM, said:

how to change background color for nav bar?

I try to override class navbar inner, but it is still not worked :(

I want to change to #443266, can i still get gradient color?


This is the original class in bootstrap.css:
.navbar-inner {
  padding-left: 20px;
  padding-right: 20px;
  background-color: #2c2c2c;
  background-image: -moz-linear-gradient(top, #333333, #222222);
  background-image: -ms-linear-gradient(top, #333333, #222222);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222));
  background-image: -webkit-linear-gradient(top, #333333, #222222);
  background-image: -o-linear-gradient(top, #333333, #222222);
  background-image: linear-gradient(top, #333333, #222222);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4px;
  -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}


You need to change and overwrite
- background-color,
- background-image, and
- filter (for IE).


No gradient:
.navbar-inner {
  background-color: #443266;
  background-image: none;
  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}

or to be super careful:
.navbar-inner {
  background-color: #443266;
  background-image: -moz-linear-gradient(top, #443266, #443266);
  background-image: -ms-linear-gradient(top, #443266, #443266);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#443266), to(#443266));
  background-image: -webkit-linear-gradient(top, #443266, #443266);
  background-image: -o-linear-gradient(top, #443266, #443266);
  background-image: linear-gradient(top, #443266, #443266);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#443266', endColorstr='#443266', GradientType=0);
}


With gradient effect using your color:
.navbar-inner {
  background-color: #443266;
  background-image: -moz-linear-gradient(top, #443266, #663288);
  background-image: -ms-linear-gradient(top, #443266, #663288);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#443266), to(#663288));
  background-image: -webkit-linear-gradient(top, #443266, #663288);
  background-image: -o-linear-gradient(top, #443266, #663288);
  background-image: linear-gradient(top, #443266, #663288);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#443266', endColorstr='#663288', GradientType=0);
}

0

#430 User is offline   giantdut 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 24-April 12
  • Location:Jakarta, Indonesia

Posted 14 May 2012 - 02:29 AM

View PostDon Felipe, on 14 May 2012 - 01:31 AM, said:

This is the original class in bootstrap.css:
.navbar-inner {
  padding-left: 20px;
  padding-right: 20px;
  background-color: #2c2c2c;
  background-image: -moz-linear-gradient(top, #333333, #222222);
  background-image: -ms-linear-gradient(top, #333333, #222222);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222));
  background-image: -webkit-linear-gradient(top, #333333, #222222);
  background-image: -o-linear-gradient(top, #333333, #222222);
  background-image: linear-gradient(top, #333333, #222222);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  border-radius: 4px;
  -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}


You need to change and overwrite
- background-color,
- background-image, and
- filter (for IE).


No gradient:
.navbar-inner {
  background-color: #443266;
  background-image: none;
  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}

or to be super careful:
.navbar-inner {
  background-color: #443266;
  background-image: -moz-linear-gradient(top, #443266, #443266);
  background-image: -ms-linear-gradient(top, #443266, #443266);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#443266), to(#443266));
  background-image: -webkit-linear-gradient(top, #443266, #443266);
  background-image: -o-linear-gradient(top, #443266, #443266);
  background-image: linear-gradient(top, #443266, #443266);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#443266', endColorstr='#443266', GradientType=0);
}


With gradient effect using your color:
.navbar-inner {
  background-color: #443266;
  background-image: -moz-linear-gradient(top, #443266, #663288);
  background-image: -ms-linear-gradient(top, #443266, #663288);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#443266), to(#663288));
  background-image: -webkit-linear-gradient(top, #443266, #663288);
  background-image: -o-linear-gradient(top, #443266, #663288);
  background-image: linear-gradient(top, #443266, #663288);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#443266', endColorstr='#663288', GradientType=0);
}



Tq2 i overide with your css and it's work. because the yii css was minified i can't see that all css. Thanks Felipe
Try to explore my intellectual capital
0

#431 User is offline   giantdut 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 24-April 12
  • Location:Jakarta, Indonesia

Posted 14 May 2012 - 05:16 AM

Hello Again, I'm sorry if i have too many question

how to get data from database for

<?php echo $form->dropDownListRow($model, 'dropdown', array('Something ...', '1', '2', '3', '4', '5')); ?>


I always get error "Cannot Object to String"

Or just give me "0" result

then wrong argument for foreach...

Tq before
Try to explore my intellectual capital
0

#432 User is offline   Alan YII 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 02-May 12

Posted 14 May 2012 - 05:47 AM

View Postgiantdut, on 14 May 2012 - 05:16 AM, said:

Hello Again, I'm sorry if i have too many question

how to get data from database for

<?php echo $form->dropDownListRow($model, 'dropdown', array('Something ...', '1', '2', '3', '4', '5')); ?>


I always get error "Cannot Object to String"

Or just give me "0" result

then wrong argument for foreach...

Tq before


I recently achieved this by doing the following. In the appropriate action in your controller, fetch your data, and pass it into your render.

	$dataProvider=new CActiveDataProvider('RoomType');
		$roomTypes = $dataProvider->getData();
		
		$roomTypesDropdown = Array(); //Store it in a simple array.
		foreach($roomTypes as $roomType) {
			$roomTypesDropdown[$roomType->id] = $roomType->description;
		}
		$this->render('create',array(
			'model'=>$model,
			'roomTypes'=>$roomTypesDropdown,
		));




Then in your form

	<?php echo $form->dropDownListRow($model,'roomid',$roomTypes); ?>


Hope that helps.

*Edit*
Don Felipe's answer below is far better.

This post has been edited by Alan YII: 14 May 2012 - 10:52 AM

Freelance web developer. UK Freelance Developer.
0

#433 User is offline   Don Felipe 

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

Posted 14 May 2012 - 05:51 AM

View Postgiantdut, on 14 May 2012 - 05:16 AM, said:

how to get data from database for

... or ...

<?php echo $form->dropDownListRow(
  $model,                       //1st: model
  'id',                         //2nd: attribute 
  CHtml::listData(              //3rd: data
    User::model()->findAll(),     // dataProvider
    'id',                         // attribute to be used as option value
    'username'                    // attribute to be displayed
  ), 
  array(                        //4th: additional htmlOptions
  )                      
); ?>


Of course you can use additional attributes and/or criteria to limit the user list with findAll().
0

#434 User is offline   Alan YII 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 02-May 12

Posted 14 May 2012 - 10:48 AM

View PostDon Felipe, on 14 May 2012 - 05:51 AM, said:

... or ...

<?php echo $form->dropDownListRow(
  $model,                       //1st: model
  'id',                         //2nd: attribute 
  CHtml::listData(              //3rd: data
    User::model()->findAll(),     // dataProvider
    'id',                         // attribute to be used as option value
    'username'                    // attribute to be displayed
  ), 
  array(                        //4th: additional htmlOptions
  )                      
); ?>


Of course you can use additional attributes and/or criteria to limit the user list with findAll().


Much nicer than the way I described. Thank you.
Freelance web developer. UK Freelance Developer.
0

#435 User is offline   dmapes123 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 21-December 10

Posted 14 May 2012 - 05:24 PM

has anybody else had issues with the carousel not having transitions since the latest upgrade?
Duncan Mapes
Challenge Media Group LLC
ideas@challengemediagroup.com | http://www.challengemediagroup.com
Twitter: http://twitter.com/duncanmapes | LinkedIn: http://linkedin.com/in/duncanmapes
1

#436 User is offline   NCS_One 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 24-August 11

Posted 15 May 2012 - 03:58 PM

Hi,

Can someone please confirm if this is a extension issue.
On a horizontal form turning off javascript or setting enableAjaxValidation and enableClientValidation to false when a form is submited an attribute that is valid, has no errors, doesn't became green because the class "success" is no added?

If it is a issue a quick fix could be changing in BootInput.php:
protected function getContainerCssClass()
{
  if ($this->model->hasErrors($this->attribute)) //I changed this before this issue, I posted why
    return CHtml::$errorCss;
  else
    if (Yii::app()->request->isPostRequest)
      return 'success';
    else
      return '';
}

Ok, soo if it has no errors and is a request of type POST I assume that it is a form submit and that the model has been validated and it is a valid attribute, so I add the class "success". If the attribute has no errors and the request is not of type POST no CSS class is added.

Some recommendations?

Also on CActiveRecord::onAfterVAlidate() could set some propertie indicating that the model validation has occurred and use it on BootInput::getContainerCssClass().
0

#437 User is offline   gricser 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 04-August 10

Posted 16 May 2012 - 10:03 PM

Hi,

thanks for the awesome extension!

I'm not a very experienced web developer so I might be missing something trivial, but once I had bootstrap preloaded, all my other jquery based extensions (fancybox, fbgallery etc) became pretty messed up. For example fancybox does not popup because the script crashes when calling hide() on a div, fbgallery has similar issues with jquery ui dialogs. Is there a conflict between bootstrap based and traditional jquery/jquery ui/CJui based widgets? Or is there some version incompatibility?

I'm using Yii 1.1.8.

Any hint or advice is greatly appreciated!

Thanks!
0

#438 User is offline   RainZ 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 16-May 12

Posted 18 May 2012 - 12:25 AM

any of you getting problems with the Bootstrap generator ?

I check at the controller

did the Bootstrap CRUD doing validation ?

		
if(isset($_POST['Post']))
{
        $model->attributes=$_POST['Post'];
	if([b]$model->save()[/b])
	$this->redirect(array('view','id'=>$model->id));
}


one more thing is, when I tried to create something,
based on the rules that I state as required
when I leave all the form blank, it just redirect me to view.
0

#439 User is offline   NCS_One 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 24-August 11

Posted 19 May 2012 - 03:15 PM

Hi,

How do you default check a radio button list?

<?php echo $form->radioButtonListInlineRow($model, 'main', array(true=>'Yes', false=>'No')); ?>

The $model->main is false but the radio false/No is not checked.
0

#440 User is offline   NCS_One 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 24-August 11

Posted 19 May 2012 - 04:14 PM

Ok, found the problem.

$model->main is of type boolean, I have to change true to 1 and false to 0.
0

Share this topic:


  • (45 Pages)
  • +
  • « First
  • 20
  • 21
  • 22
  • 23
  • 24
  • 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