This is the discussion thread for my latest extension, Bootstrap.
What is Bootstrap?
Bootstrap is a toolkit to kickstart development of web applications. It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation and more. Bootstrap has been developed by Twitter, it is open source and can be found on Github.
Why an extension?
After trying out Bootstrap I immediately decided that it was time to write an extension to allow developers to easily implement this awesome toolkit in their existing and upcoming Yii-projects.
I’m actually also using it with LESS but I’m using it trough my own less extension (that I haven’t published yet) which uses Agar’s LESS compiler, less.php (https://github.com/agar/less.php).
However, I don’t see why you couldn’t use less.js with the extension. The less-files are included in the less-folder.
Of course, you do not always ONLY want a Menu in there. For example, you want infos about
the current logged in user, a search input field, and so-on. This could be accomplished
by something like this:
$this->widget('ext.bootstrap.widgets.topbar',array(
array(
'class' => 'CMenu',
'items' => ...
),
array(
'class' => 'Searchbox' // render a search box
),
array(
'class' => 'UserInfo' // render info about the current logged in user
'template' => Yii::t('You are currently logged in as {username}', array('{username}' => $user)),
),
),
What do you think?
Edit: with a little bit of adjustment i also got the drop-down menu working. Nice !
Would also go into the navbar extension. "secondary nav" is also supported by bootstrap!
@thyseus: Initially I thought that the top bar is a bit too complicated to be a widget but I need to re-think it. Maybe it would be possible to do it as a widget after all. It could also be done with beginWidget / endWidget, but then it would be really simple.
Edit: Another solution could be to use a template string to achieve this.
@thyseus: Seems a bit complicated, wouldn’t it have been better to extend CMenu? The idea with BootWidget was to provide common functionality for registering JavaScript libraries for the widgets. The topbar doesn’t require any extra JS so it could as well extend CMenu. I’ll see what I can do about the topbar but it isn’t highest on my priority list. I’d also like separate widgets for the searchbox, menu, topbar, etc.
hi, is there a way to disable/do not display <label> and/or outer div.clearfix for some inputs? Sometime I need to get two or more inputs on the same row and it seems it is impossible now.
The “single line of code” is cool, but sometime it cannot be very flexible
EDIT: Looking at the code it seems it is possible. Now I have to find out how to pass $label=false from view
I want to see a twipsy tip on some input form element on focus event, but jquery.boottwipsy.js does not take into account a "trigger" option.
Also the default $selector is ‘.twipsy’, but bootstrap.min.css has declared class .twipsy in it. So when I add this class to any form input element, I see that font decrease to 11px.
@lehandr: Twipsy was originally only meant for links but I can see why you’d like to have it on a focus event. I have to think about adding the functionality when I have time. Regarding your selector issue, you have two options. You can either specify the selector yourself by giving it as an “argument” to the widget or you can override the .twipsy class in your own CSS.
@lehandr: In your case I wouldn’t use BootInputBlock. The widget was designed to cover only the most common cases to keep it simple. I hope this answers your question.