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

Jump to content

  • (45 Pages)
  • +
  • « First
  • 32
  • 33
  • 34
  • 35
  • 36
  • 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

#661 User is offline   Ghost_nsk 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 14-July 12

Posted 27 August 2012 - 06:40 AM

hello, I'd like to use several checkboxes in form like this:
<?php
            echo $form->checkBoxListRow($model, 'checkboxes', array(
                '1' => 'Label 1',
                '2' => 'Label 2',
                '3' => 'Label 3',
            ));
            ?>

and save the values of checked checkboxes to database, but It saves the "Array" value, and while editing the post, no checkboxes are switched, are there any advices to solve this problem? Thanx
0

#662 User is offline   Argenis Bolivar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 27-February 11

Posted 27 August 2012 - 03:11 PM

Houston we have a "Bandwidth Limit Exceeded"
0

#663 User is offline   Chris83 

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

Posted 27 August 2012 - 05:56 PM

View PostArgenis Bolivar, on 27 August 2012 - 03:11 PM, said:

Houston we have a "Bandwidth Limit Exceeded"

It's being fixed. Please be patient.
Best regards,
Chris

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

Follow me:
Twitter | GitHub | Bitbucket
0

#664 User is offline   Lothor 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 05-August 11
  • Location:Brazil

Posted 28 August 2012 - 12:47 PM

Hello, I'm working with AJAX and I'm running

$this->controller->renderPartial($view, $params, false, true);

With this, the CSS files "Bootstrap" on page being reloaded unnecessarily.

How to solve?
0

#665 User is offline   serginxs 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 31-March 11

Posted 28 August 2012 - 04:51 PM

Hello,when i click on any dropdown element class open adds no parent element (<li>), but the current link, and dropdown list not open.
please help
0

#666 User is offline   serginxs 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 31-March 11

Posted 28 August 2012 - 04:59 PM

Seems to conflict with the extension TinyMce
0

#667 User is offline   Lothor 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 05-August 11
  • Location:Brazil

Posted 29 August 2012 - 01:22 PM

View PostLothor, on 28 August 2012 - 12:47 PM, said:

Hello, I'm working with AJAX and I'm running

$this->controller->renderPartial($view, $params, false, true);

With this, the CSS files "Bootstrap" on page being reloaded unnecessarily.

How to solve?

Please, help me.
0

#668 User is offline   Travis Stroud 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 29-August 12

Posted 29 August 2012 - 06:42 PM

Hi, a little question. Is there a simple way to inset a sign-in form inside of a navbar dropdown? There is an example used outside of Yii (I cannot post links since this is my first post) if you search google for "bootstrap login in dropdown". Should be first result.
0

#669 User is offline   Don Felipe 

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

Posted 29 August 2012 - 09:39 PM

View PostRandom Name, on 29 August 2012 - 06:42 PM, said:

Hi, a little question. Is there a simple way to inset a sign-in form inside of a navbar dropdown? There is an example used outside of Yii (I cannot post links since this is my first post) if you search google for "bootstrap login in dropdown". Should be first result.


Someone posted the same question a few weeks ago. Find my answer here. Don't forget to set 'encodeLabel'=>false in TbMenu. Plus the submit button and a few styles and you'll have it. Cheers.
0

#670 User is offline   Don Felipe 

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

Posted 29 August 2012 - 09:50 PM

View PostLothor, on 29 August 2012 - 01:22 PM, said:

With this, the CSS files "Bootstrap" on page being reloaded unnecessarily.
How to solve?
Please, help me.


Usually you have to play around with the 2 boolean parameters for $return and $processOutput. If all this doesn't help much, check this link: how to manually omit loading css and js files that have already been included by yii. Hope it helps. Cheers.
0

#671 User is offline   Lothor 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 05-August 11
  • Location:Brazil

Posted 30 August 2012 - 09:58 AM

View PostDon Felipe, on 29 August 2012 - 09:50 PM, said:

Usually you have to play around with the 2 boolean parameters for $return and $processOutput. If all this doesn't help much, check this link: how to manually omit loading css and js files that have already been included by yii. Hope it helps. Cheers.

That's exactly what I want!

Even had read the link...

The JavaScript files I can prevent them from being loaded.

But CSS files Yii Bootstrap not.

Do you understand what I mean?
0

#672 User is offline   Don Felipe 

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

Posted 30 August 2012 - 01:00 PM

View PostLothor, on 30 August 2012 - 09:58 AM, said:

That's exactly what I want!

Even had read the link...

The JavaScript files I can prevent them from being loaded.

But CSS files Yii Bootstrap not.

Do you understand what I mean?


So what happens if you do
$this->controller->renderPartial($view, $params, false, false);
instead of 'false, true'?
This pre-processes the output of the ajax content before sending it to the main view. Of course, in some cases this is counter-dynamic; e.g. when the ajax is part of tabbed content. If it still does not work please post your code (controller, main view, ajax view). Boa sorte, Felipe
0

#673 User is offline   Lothor 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 05-August 11
  • Location:Brazil

Posted 30 August 2012 - 02:18 PM

View PostDon Felipe, on 30 August 2012 - 01:00 PM, said:

So what happens if you do
$this->controller->renderPartial($view, $params, false, false);
instead of 'false, true'?
This pre-processes the output of the ajax content before sending it to the main view. Of course, in some cases this is counter-dynamic; e.g. when the ajax is part of tabbed content. If it still does not work please post your code (controller, main view, ajax view). Boa sorte, Felipe

Leaving as shown below:

$this->controller->renderPartial($view, $params, false, false);


The files are not loaded on the page unnecessarily.

Perfect! But in my view, I have a new AJAX call, with "ProcessOutput = false", the call is not performed, because the script is not embedded page.

With "ProcessOutput = true", the new call (originating from the renderPartial) is performed, but this ends up happening incorporation of unnecessary scripts like JQuery and Bootstrap.

The JQuery I managed to keep it from being loaded, but need to know how to get the Bootstrap not.

My IndexAction.php:

class IndexAction extends CAction {
    
    public function run() {
        if (Yii::app()->request->isAjaxRequest) {            
            $this->controller->renderPartial('index', null, false, true);
            Yii::app()->end();
        }
        
        $this->controller->render('index');
    }
    
}


The JQuery (and all JS) I managed to make it only be built once the page with the extension nlsclientscript.
0

#674 User is offline   Sage 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 29-August 12
  • Location:California, USA

  Posted 30 August 2012 - 02:33 PM

Can someone explain how to remove the automatic labels generated by $form->dropDownListRow()?

In post #612, Chris83 said:

View PostChris83, on 05 August 2012 - 03:42 AM, said:

Setting label to false should do the trick.


I tried this:
<?php echo $form->dropdownlistRow( $model, "account", 
    array(
        "1" => "1",
        "2" => "2",
        "3" => "3",
    ),
    array(
        'label'=>false
    )
); ?>


But, the label is still there.
0

#675 User is offline   Don Felipe 

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

Posted 31 August 2012 - 02:02 AM

View PostSage, on 30 August 2012 - 02:33 PM, said:

Can someone explain how to remove the automatic labels generated by $form->dropDownListRow()?

In post #612, Chris83 said:

I tried this:
<?php echo $form->dropdownlistRow( $model, "account", 
    array(
        "1" => "1",
        "2" => "2",
        "3" => "3",
    ),
    array(
        'label'=>false
    )
); ?>


But, the label is still there.


It's a little bit tricky to get there. Setting and alternate or no label for form elements is different from setting it for buttons, for instance. Here's how:
array(
    'labelOptions'=>array('label'=>false),
    'style'=>'display:block; margin-top:10px;', //see comment below
)

As you can see you have to add another array 'labelOptions' inside the one for 'htmlOptions'. Unfortunately, in a vertical-form the label-less drop down will float around the previous form element unless you add the 'display:block'.

Just in case, depending on the form element ($form->...) there are a couple of options that can be added inside the array for htmlOptions:

arrays: labelOptions, prependOptions, appendOptions, hintOptions, errorOptions, and captchaOptions,
string: hint, prepend, append

All the names are self-explanatory. It may look complicated on first view but it makes perfect sense. Adding additional arrays like that gives you the options to set different styles for all the different elements (label, input, appended input, hint, etc).

Hope it helps.
0

#676 User is offline   Lothor 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 05-August 11
  • Location:Brazil

Posted 31 August 2012 - 09:56 AM

View PostLothor, on 28 August 2012 - 12:47 PM, said:

Hello, I'm working with AJAX and I'm running

$this->controller->renderPartial($view, $params, false, true);

With this, the CSS files "Bootstrap" on page being reloaded unnecessarily.

How to solve?

Nobody owned a solution? = /

Do not know about you, but I find absurd reload all the CSS files whenever a new request is made​​.

Has anyone experienced this problem too?
0

#677 User is offline   Daniel 

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

Posted 02 September 2012 - 01:03 AM

Hi,

I got a problem. Now, the TbAlert is not automatically closed after several seconds. Is it a normal behavior? or how should I make it automatically closed say after 10 seconds?

Cheers,

Daniel
0

#678 User is offline   Jadambaa 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 02-September 12

Posted 02 September 2012 - 05:44 AM

i like bootstrap. i use it. develop very well
0

#679 User is offline   yiqing95 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 592
  • Joined: 27-December 10
  • Location:china

Posted 02 September 2012 - 09:17 AM

View PostLothor, on 28 August 2012 - 12:47 PM, said:

Hello, I'm working with AJAX and I'm running

$this->controller->renderPartial($view, $params, false, true);

With this, the CSS files "Bootstrap" on page being reloaded unnecessarily.

How to solve?

actually i met the same problem long time ago and have to modify the Bootstrap class :
	/**
	 * Initializes the component.
	 */
	public function init()
	{
		// Register the bootstrap path alias.
		if (Yii::getPathOfAlias('bootstrap') === false)
			Yii::setPathOfAlias('bootstrap', realpath(dirname(__FILE__).'/..'));

        //.........................................................................
        // added by yiqing95
        if(Yii::app()->getRequest()->getIsAjaxRequest()){
            //if is ajax mode shouldn't register css and js files again !
            return ;
        }
        //.........................................................................
		// Prevents the extension from registering scripts and publishing assets when ran from the command line.
		if (Yii::app() instanceof CConsoleApplication)
			return;

		if ($this->coreCss !== false)
			$this->registerCoreCss();

		if ($this->responsiveCss !== false)
			$this->registerResponsiveCss();

		if ($this->yiiCss !== false)
			$this->registerYiiCss();

		if ($this->enableJS !== false)
			$this->registerCoreScripts();

        parent::init();
	}

:D
want to listen how others settle this problem !
0

#680 User is offline   Lothor 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 05-August 11
  • Location:Brazil

Posted 03 September 2012 - 07:24 AM

yiqing95, Thank you for your solution!

To be honest I did not want to change the Core Yii Bootstrap.

But apparently it is the only way to solve the problem agree?

Well, the good news is that solved the problem.

Below is the steps that were made:

I added the extension NLSClientScript to the project.

Adding it, solved the problem with scripts.

Now let's resolution CSS.

In Bootstrap.php:

// I created a new property.

/**
 * @var boolean to register the Bootstrap in AJAX requests
 * Defaults to true.
 */
public $ajaxCssImport = true;

// And added the following conditional
if(($this->ajaxCssImport && Yii::app()->request->isAjaxRequest) || !Yii::app()->request->isAjaxRequest ) {
    // Prevents the extension from registering scripts and publishing assets when ran from the command line.
    if (Yii::app() instanceof CConsoleApplication)
	    return;

    if ($this->coreCss !== false)
	    $this->registerCoreCss();

    if ($this->responsiveCss !== false)
	    $this->registerResponsiveCss();

    if ($this->yiiCss !== false)
	    $this->registerYiiCss();
}

if ($this->enableJS !== false)
	$this->registerCoreScripts();


In main.php

'bootstrap' => array(
    'class' => 'ext.bootstrap.components.Bootstrap',
    'ajaxCssImport' => false,
),


With that solved my problem.

Anyway you had spoken...

// added by yiqing95
if(Yii::app()->getRequest()->getIsAjaxRequest()){
    //if is ajax mode shouldn't register css and js files again !
    return ;
}


It does not solve the problem.

The CSS files are not loaded, but the AJAX code that is generated by the view that is being called, is not.

So below is outside the conditional parole that I created.

if ($this->enableJS !== false)
	$this->registerCoreScripts();


And adding the extension "NLSClientScript" was necessary because the other JS files, including "bootstrap.js" remained loaded.

Well, that's it, I was happy to resolve the issue and then let the new amendment as a suggestion for a future version of "Yii Bootstrap".

Thanks to everyone who helped me troubleshoot.
0

Share this topic:


  • (45 Pages)
  • +
  • « First
  • 32
  • 33
  • 34
  • 35
  • 36
  • 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