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

Jump to content

  • (45 Pages)
  • +
  • « First
  • 37
  • 38
  • 39
  • 40
  • 41
  • 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

#761 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,193
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 18 October 2012 - 03:11 AM

I found great Bootswatch project, with many cool styles for Bootstrap.

The only problem, for me right now, is how to change *.less files, required to change overall look, without digging in extension sourece code. Could this be done outside extension?
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#762 User is offline   Don Felipe 

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

Posted 18 October 2012 - 03:26 AM

View PostTrejder, on 18 October 2012 - 03:11 AM, said:

I found great Bootswatch project, with many cool styles for Bootstrap.

The only problem, for me right now, is how to change *.less files, required to change overall look, without digging in extension sourece code. Could this be done outside extension?


There's something like a less online tester and compiler - google for "less tester" or "less compiler" should be up in the result;... or you can use this php compiler; online or local.

Not sure how up-to-date these are btw. Just give it a try.
0

#763 User is offline   yiqing95 

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

Posted 18 October 2012 - 04:05 AM

View Postyiistudent, on 13 October 2012 - 11:41 AM, said:

How to use BootDatePicker?

refer here jqueryUi4bootstrap :lol: use the yii-booster you can use the TbDatePicker and the CJuiDatePicker
0

#764 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,193
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 18 October 2012 - 04:34 AM

View PostDon Felipe, on 18 October 2012 - 03:26 AM, said:

Not sure how up-to-date these are btw. Just give it a try.

Compliling .less files is not a problem for me. The real problem is to be able to change .less files extension uses, to change the layout, without changing extension source files or code.
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#765 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,193
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 18 October 2012 - 05:52 AM

View PostDon Felipe, on 12 October 2012 - 10:02 PM, said:

Unfortunately there is no option to define how to open a submenu (click vs hover) no matter what level. Not sure if you can achieve this by just adding css classes through "itemOptions" and "linkOptions"?

A small solution is to set collapse to true. This will change toolbar (along with menus and submenus) to a very nice, clickable thing on small screens.

But this will fail on large ones, like iPad, where there is enough space to draw whole toolbar but where there is no hover gesture.
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#766 User is offline   Don Felipe 

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

Posted 18 October 2012 - 05:58 AM

View PostTrejder, on 18 October 2012 - 05:52 AM, said:

A small solution is to set collapse to true. This will change toolbar (along with menus and submenus) to a very nice, clickable thing on small screens.

But this will fail on large ones, like iPad, where there is enough space to draw whole toolbar but where there is no hover gesture.


well, the extension should offer this choice. it should be developer's and client's choice - there's people who prefer one or the other. just my 2 cents.
0

#767 User is offline   Don Felipe 

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

Posted 18 October 2012 - 06:05 AM

View PostTrejder, on 18 October 2012 - 04:34 AM, said:

Compliling .less files is not a problem for me. The real problem is to be able to change .less files extension uses, to change the layout, without changing extension source files or code.


I've never used Bootswatch so I don't know how the download file looks like.
I assume it's another bootstrap.css.

You can set coreCss=false in config/main.php and load/register the new bootstrap in the layout files (before any additional css files). This way you won't touch the original. Put the new bootstrap wherever you want. /css or in the extension folder. Depending on location you have to register or publish/register.

add-on:
unfortunately there is no way to set coreCss=false and set an alternative url right there in the bootstrap's config. at least not that i know of. maybe that would be another nice feature for future updates?
0

#768 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,193
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 19 October 2012 - 02:36 AM

View PostDon Felipe, on 18 October 2012 - 06:05 AM, said:

I've never used Bootswatch so I don't know how the download file looks like. I assume it's another bootstrap.css.

Chris has responded to my comment and assured me that using Bootswatch shouldn't be any problem. I'm going to test this these days or next week and I'll write down here (or craft a small wiki article), if I find something interesting.
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#769 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,193
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 21 October 2012 - 07:57 AM

If button can be toggled:

<?php $this->widget('bootstrap.widgets.TbButton', array(
    'buttonType'=>'button',
    'type'=>'primary',
    'label'=>'Toggle me',
    'toggle'=>true,)); ?>

or is stateful:

<?php $this->widget('bootstrap.widgets.TbButton', array(
    'buttonType'=>'button',
    'type'=>'primary',
    'label'=>'Click me',
    'loadingText'=>'loading...',
    'htmlOptions'=>array('id'=>'buttonStateful'),
)); ?>

then, is there any way, I can read it's state in it's onClick or any other event?

Chris' example shows only how to change state of a button:

$('#buttonStateful').click(function() {
    var btn = $(this);
    btn.button('loading'); // call the loading function
    setTimeout(function() {
        btn.button('reset'); // call the reset function
    }, 3000);
});

Examples at Bootstrap page are quite similar.

I've analysed source code of extensions\bootstrap\lib\bootstrap\js\bootstrap-button.js, but found nothing that I could use for this purpose.

EDIT: There is, of course, a simple way of checking button's class:

<script type="text/javascript">
    $('#klawiszek').click(function()
    {
        var btn = $(this);
        console.log(btn.hasClass('active'));
    });
</script>

I'm looking, if there is any more professional way of doing this.

This post has been edited by Trejder: 21 October 2012 - 10:54 AM

Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#770 User is offline   luismcax 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 17-September 12

Posted 23 October 2012 - 07:20 AM

Hello

First, let me thank the creator of this fantastic extension.

That said, let me tell you what brought me here.
Iam a yii newbie (started a week ago) and i want to use the Thumbnail grid in order to display some countries images, and then i want to drill in each country and display the cities, etc, without reloading the entire screen, just the right side.


Code for the create view
<?php 
    echo $this->renderPartial('_form', $this);
?>



Between other things this view below is used to display the images. It has two divs. One for picking the images that relates to the countries/cities, the other displays the choice that the user made in terms of city by clicking in a button that is supposed to be near the picture, but only when the user drills into the cities.
1st doubt -> should i be rendering partials? I only want to refresh the right side of the screen, the one that has the images. Take into account that iam rendering one partial in the previous code, and other below. Is that even possible? :rolleyes:
<div id="detailInputDataFields" class="row">
                
                <?php 
                    
                    $this->renderPartial('_formCountry', $this);
                
                ?>
</div>



This view is responsible for loading the widget
<?php

$dataProvider = new CActiveDataProvider('Country');

$this->widget('bootstrap.widgets.TbThumbnails', array(
    'id' => 'countryThumbId',
    'dataProvider' => $dataProvider,
    'template' => "{items}\n{pager}",
    'itemView' => '_countryThumb',
));


?>



The view below fills it with images of the countries, and sends the id of Country via post.
2nd doubt -> How can i drill down clicking the image, instead of having a button to do that???
<li class="span3">
    <a href="#" class="thumbnail" rel="tooltip" data-title=" <?php echo $data['name']; ?>">
        <img src="<?php echo Yii::app()->getBaseUrl() . $data['photo'] ?>" alt="">
        <a href=
           "
           <?php echo $this->createUrl('city/view', array('id' => $data['id'])); ?>
           "
           >
               <?php echo $data['name']; ?>
        </a>

        <?php
        
        $this->widget('bootstrap.widgets.TbButton', array(
            'label' => 'cidades',
            'buttonType' => 'ajaxButton',
            'type' => 'primary', // null, 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
            'size' => 'mini', // null, 'large', 'small' or 'mini'
            'url' => Yii::app()->createUrl("tripDetail/showCities"),
            'ajaxOptions' =>
                    array('data' =>
                        array(
                            'id' => $data['id'],
                        ),
                        'type' => 'POST',
                    )
                )
        );
        ?>

    </a>
</li>



This action is fired upon button click and gets a new dataProvider based on the country the user picked
3rd doubt -> how many renderPartials can be nested????
public function actionShowCities()
        {
            $cityId = $_POST['id'];
            
            $dataProvider = $this->getCities($cityId);
            
            $this->renderPartial('_formCity', array('dProvider'=>$dataProvider));
                        
        }



The action above fires up this view _formCity which in turn calls _cityThumb
<?php

$this->widget('bootstrap.widgets.TbThumbnails', array(
    'id' => 'countryThumbId',
    'dataProvider' => $dProvider,
    'template' => "{items}\n{pager}",
    'itemView' => '_cityThumb',
));


?>



_cityThumb
[color="#FF0000"]4th doubt -> The cities were the only screen that was rendered, when i clicked the button to show me the cities, nothing happened, why???? ???

<li class="span3">
    <a href="#" class="thumbnail" rel="tooltip" data-title=" <?php 
        
    echo $data['name']; ?>">
        <img src="<?php echo Yii::app()->getBaseUrl() . $data['photo'] ?>" alt="">
        <a href=
           "
           <?php 
                echo $this->createUrl('place/view', array('id' => $data['id'])); 
           ?>
           "
           >
               <?php echo $data['name']; ?>
        </a>

        

    </a>
</li>



Sorry for the long post and so many doubts, but its my first time with a php framework....and yii is not that easy, at least at first.
:-[
0

#771 User is offline   Salas 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 23-October 12
  • Location:Bogota, Colombia

Posted 23 October 2012 - 09:34 AM

Hi Everybody,

i am working with the TbGridView component, i am loading it with a dataprovider, in this dataprovider i am adding a criteria to bring relational data, everything is working ok for now, but the component is showing me the new header column without the link to order data, i need the same options to order the gridview.

Any suggestion? maybe an example.

Thanks for your help.
0

#772 User is offline   Don Felipe 

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

Posted 23 October 2012 - 10:43 AM

View PostSalas, on 23 October 2012 - 09:34 AM, said:

Hi Everybody,

i am working with the TbGridView component, i am loading it with a dataprovider, in this dataprovider i am adding a criteria to bring relational data, everything is working ok for now, but the component is showing me the new header column without the link to order data, i need the same options to order the gridview.

Any suggestion? maybe an example.

Thanks for your help.


Hi Salas,

TbGridView extends CGridView hence your question is not related to this extension. However, you will find your answer here. Read it once and make sure to follow it step by step!

Cheers, DF
0

#773 User is offline   Salas 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 23-October 12
  • Location:Bogota, Colombia

Posted 23 October 2012 - 10:55 AM

View PostDon Felipe, on 23 October 2012 - 10:43 AM, said:

Hi Salas,

TbGridView extends CGridView hence your question is not related to this extension. However, you will find your answer here. Read it once and make sure to follow it step by step!

Cheers, DF


Hi Don Felipe,

tks, i will try it.
0

#774 User is offline   pod2g 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 20-May 12

Posted 23 October 2012 - 09:32 PM

Hello Chris83,

1stly would like to thanks for an awesome extension.
I just tested my app on iPad today, the dropdown (TbMenu) does not work.
When i click on the sub menu it just close, no action trigger. I look like on iPad browser it does not recognize click.
I also test on your demo web site, it does not work as well.

Any work around solution here ?

Thanks,
pod2g
0

#775 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,193
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 24 October 2012 - 12:16 AM

Hi luismcax,

Yes. Your post is quite long, so sorry, if my answer isn't that much detailed. I'll try to help you as much as I can.

First of all. If my answer doesn't help you too much, try to separate your post into parts that concers Yii itself (most things about renderPartial, which is core framework function) and these parts that concerns Yii-Bootstrap extension. Ask first question into general Yii Framework Discussion forum.

View Postluismcax, on 23 October 2012 - 07:20 AM, said:

1st doubt -> should i be rendering partials? I only want to refresh the right side of the screen, the one that has the images. Take into account that iam rendering one partial in the previous code, and other below. Is that even possible?

I think you misunderstood, how renderPartial works and for what purpose it should be used.

First. It actually renders a partial view as a part of rendering whole page. It's mainly use to separate large view into smaller, maybe more readable files. Or to extract parts used in many views into the separate sub-view. So, you can use as much partialRenders as you want. But, to be honest I have never seen a working example, where you use only renderPartials, directly in controller, without using one general render function. I always use it that way, that no matter, if I'm updating whole page or just a part of it, I always use render in my controller and renderPartials are only used inside view files (or layouts or themes) to render subviews, parts of them etc.

Get into class reference and watch for the source code for CController.renderPartial and other similar functions and try to catch the differences. There are slightly in most cases.

Second. Don't forget that you have to make an AJAX call and add extra JavaScript code in your view to actually put parts of your page that has changed into relevant part of your page. renderPartial itself won't do that for you. This is a purely server-side (PHP) function and it won't do nothing on client side for you.

This is the kind of question, you should ask on general forum, not here, if you still have problems with that. Write there a question, if someone can give you some example of using renderPartial and AJAX call for updating just a part of your page. You should get immediate response. Write me a PM with a link to such question, then I'll try to diggout mine own old example and put you there. I'm forcing you to create a new question, because this is not related to this extension and because I hope other, that don't use Yii-Bootstrap at all, will benefit from answers put to such question asked in general thread.

View Postluismcax, on 23 October 2012 - 07:20 AM, said:

2nd doubt -> How can i drill down clicking the image, instead of having a button to do that???

If you would won't to do that with a simple image ("img" tag), then the answer would be quite simple. You have to use htmlOptions of such image (when rendering it into page, with for example CHtml::tag or many others) and add there click element that you would point into JavaScript function that will make an AJAX call, get the results and put them into part of your page, where you want them to be put. This is one of way of solving it. There are few others. Try to search the forum, question like that was a lot.

But, since you want to use it on Yii-Bootstrap thumbnail widget, then the answer isn't that simple. I must admit, that I don't have much experience with this and that someone who used this widget a bit more, will have to help you.

View Postluismcax, on 23 October 2012 - 07:20 AM, said:

3rd doubt -> how many renderPartials can be nested?

See above. As much as you want.

View Postluismcax, on 23 October 2012 - 07:20 AM, said:

The action above fires up this view _formCity which in turn calls _cityThumb
<?php

$this->widget('bootstrap.widgets.TbThumbnails', array(
    'id' => 'countryThumbId',
    'dataProvider' => $dProvider,
    'template' => "{items}\n{pager}",
    'itemView' => '_cityThumb',
));

You didn't provide code for _viewCity action, so I don't know, if it really calls _viewThumb. But, first of all, don't mess actions with views. Action can render a view, but names aren't the same. If you have action named _viewThumb for example, it won't automatically render you the same view until you order it to do this. Beside, actions are fired in controllers, not in view. View itself can't fire any action. It can only do a redirect, which, as an effect will change the URL and call different controller, which will then call another action. This breaks MVC design pattern (redirects should be done in controllers, not in views), but generally works.

Second. Code example above, shows that TbThumbnails should render (use) _cityThumb view. And, this will not fire any action! It will only render a view, which name you provided in itemView parameter. So, if you're expecting that any action will be fired this way, it won't.

View Postluismcax, on 23 October 2012 - 07:20 AM, said:

4th doubt -> The cities were the only screen that was rendered, when i clicked the button to show me the cities, nothing happened, why


See all above answers. You have to provide extra JavaScript code (many ways to achieve it) in your view, that will fire an AJAX call (which will call proper controller and action), handle results received and put them into part, you want to update. renderPartial won't do this for you itself. Plus -- clear the idea, you look and think about it. Don't mess views with actions. These are not the same.
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#776 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,193
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 24 October 2012 - 12:25 AM

View Postpod2g, on 23 October 2012 - 09:32 PM, said:

I just tested my app on iPad today, the dropdown (TbMenu) does not work.
When i click on the sub menu it just close, no action trigger. I look like on iPad browser it does not recognize click.
I also test on your demo web site, it does not work as well.

This question was already asked by me in this forum (look here). So try to use a search before reposting the same question. Simple "bootstrap submenu" search should reveal you, that this question was already asked.

As I found myself, this is not Yii-Bootstrap (Chris extension) but whole Twitter Bootstrap issue. Submenus are always opened on hover, not mouse click, which makes them completely unusable in mobile devices.

Look for my answer here. The only workaround I found is to set collapse to true. This will change menu on smaller screens into nice collapsible widget. But it will most likely fail on large screens, like your mentioned iPad.

I can't understand how it is possible, that developers in such big and wide known project has omitted so extremely obvious thing? But, the facts are as they're. Twitter Bootstrap has currently no support for submenus on mobile devices. Maybe they assumed, that you won't use submenus on pages for mobile devices and though you should limit yourself into one-level menu structure there? I don't know.
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#777 User is offline   Don Felipe 

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

Posted 24 October 2012 - 12:54 AM

View Postluismcax, on 23 October 2012 - 07:20 AM, said:

Iam a yii newbie (started a week ago)...

Sorry for the long post and so many doubts, but its my first time with a php framework....and yii is not that easy, at least at first.


Try one of the online tutorials or the beginner's guide; especially the article "Yii for beginners". You can't build a house without a solid foundation.
0

#778 User is offline   pod2g 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 20-May 12

Posted 24 October 2012 - 03:45 AM

View PostTrejder, on 24 October 2012 - 12:25 AM, said:

This question was already asked by me in this forum (look here). So try to use a search before reposting the same question. Simple "bootstrap submenu" search should reveal you, that this question was already asked.

As I found myself, this is not Yii-Bootstrap (Chris extension) but whole Twitter Bootstrap issue. Submenus are always opened on hover, not mouse click, which makes them completely unusable in mobile devices.

Look for my answer here. The only workaround I found is to set collapse to true. This will change menu on smaller screens into nice collapsible widget. But it will most likely fail on large screens, like your mentioned iPad.

I can't understand how it is possible, that developers in such big and wide known project has omitted so extremely obvious thing? But, the facts are as they're. Twitter Bootstrap has currently no support for submenus on mobile devices. Maybe they assumed, that you won't use submenus on pages for mobile devices and though you should limit yourself into one-level menu structure there? I don't know.


Thanks dude, will googling next time before ask

Cheers,
pod2g
0

#779 User is offline   luismcax 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 17-September 12

Posted 24 October 2012 - 04:52 AM

My answer to Trejder is being considered spam :mellow:

Trejder, I have sent you an email.

I cannot post the answer here, somehow the forum marks it as spam :unsure:

This post has been edited by luismcax: 24 October 2012 - 05:06 AM

0

#780 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,193
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 24 October 2012 - 05:42 AM

View Postpod2g, on 24 October 2012 - 03:45 AM, said:

Thanks dude, will googling next time before ask

Don't get offended. It was not a problem for me to copy you my own answer. But it is a generally good pratice to search before ask and not to double already answered questions.

Hope, that my example with collapse will bring you any help.

Cheers,
Trejder
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

Share this topic:


  • (45 Pages)
  • +
  • « First
  • 37
  • 38
  • 39
  • 40
  • 41
  • 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