Miscellaneous Utilities
You use boxes to wrap up elements with a nice window effect. A Box is like a CPortlet type widget with the beauty of Bootstrap.
<?php $this->widget('yiiwheels.widgets.box.WhBox', array(
'title' => 'Basic Box',
'headerIcon' => 'icon-home',
'content' => 'My Basic Content (you can use renderPartial here too :))'
)); ?>
Wrap any content within.
<?php $box = $this->beginWidget('bootstrap.widgets.TbBox', array(
'title' => 'Advanced Box',
'headerIcon' => 'icon-th-list',
// when displaying a table, if we include bootstra-widget-table class
// the table will be 0-padding to the box
'htmlOptions' => array('class'=>'bootstrap-widget-table')
));?>
<?php $this->renderPartial('partials/_table');?>
<?php $this->endWidget();?>
You can also set actions to a box, so they can nicely display on its right corner as a dropdown button -icon actions on the way :)
Heads Up! Now you can add any type of buttons to boxes
<?php
$this->widget(
'yiiwheels.widgets.box.WhBox',
array(
'title' => 'test',
'headerIcon' => 'icon-home',
'headerButtons' => array(
TbHtml::buttonGroup(
array(
array('label' => 'Left'),
array('label' => 'Middle'),
array('label' => 'Right'),
)
),
' ',
TbHtml::buttonDropdown(
'Action',
array(
array('label' => 'Action', 'url' => '#'),
array('label' => 'Another action', 'url' => '#'),
array('label' => 'Something else here', 'url' => '#'),
TbHtml::menuDivider(),
array('label' => 'Separate link', 'url' => '#'),
)
),
)
));
?>
Sebastian Tschan has done it again. We already know its work through the JQuery File Uploader but its full refactor of the bootstrap image library
Blueimp Gallery is a touch-enabled, responsive and customizable image & video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers. It features swipe, mouse and keyboard navigation, transition effects, slideshow functionality, fullscreen support and on-demand content loading and can be extended to display additional. For more information, please visit http://blueimp.github.io/Gallery/
<?php $items = array(
array(
'url' => 'http://farm8.static.flickr.com/7429/9478294690_51ae7eb6c9_b.jpg',
'src' => 'http://farm8.static.flickr.com/7429/9478294690_51ae7eb6c9_s.jpg',
'options' => array('title' => 'Camposanto monumentale (inside)')
),
array(
'url' => 'http://farm3.static.flickr.com/2863/9479121747_0b37c63fe7_b.jpg',
'src' => 'http://farm3.static.flickr.com/2863/9479121747_0b37c63fe7_s.jpg',
'options' => array('title' => 'Hafsten - Sunset')
),
array(
'url' => 'http://farm4.static.flickr.com/3712/9478186779_81c2e5f7ef_b.jpg',
'src' => 'http://farm4.static.flickr.com/3712/9478186779_81c2e5f7ef_s.jpg',
'options' => array('title' => 'Sail us to the Moon')
),
array(
'url' => 'http://farm4.static.flickr.com/3789/9476654149_b4545d2f25_b.jpg',
'src' => 'http://farm4.static.flickr.com/3789/9476654149_b4545d2f25_s.jpg',
'options' => array('title' => 'Sail us to the Moon')
),
array(
'url' => 'http://farm8.static.flickr.com/7429/9478868728_e9109aff37_b.jpg',
'src' => 'http://farm8.static.flickr.com/7429/9478868728_e9109aff37_s.jpg',
'options' => array('title' => 'Sail us to the Moon')
),
array(
'url' => 'http://farm4.static.flickr.com/3825/9476606873_42ed88704d_b.jpg',
'src' => 'http://farm4.static.flickr.com/3825/9476606873_42ed88704d_s.jpg',
'options' => array('title' => 'Sail us to the Moon')
),
array(
'url' => 'http://farm4.static.flickr.com/3749/9480072539_e3a1d70d39_b.jpg',
'src' => 'http://farm4.static.flickr.com/3749/9480072539_e3a1d70d39_s.jpg',
'options' => array('title' => 'Sail us to the Moon')
),
array(
'url' => 'http://farm8.static.flickr.com/7352/9477439317_901d75114a_b.jpg',
'src' => 'http://farm8.static.flickr.com/7352/9477439317_901d75114a_s.jpg',
'options' => array('title' => 'Sail us to the Moon')
),
array(
'url' => 'http://farm4.static.flickr.com/3802/9478895708_ccb710cfd1_b.jpg',
'src' => 'http://farm4.static.flickr.com/3802/9478895708_ccb710cfd1_s.jpg',
'options' => array('title' => 'Sail us to the Moon')
),
);?>
<?php $this->widget('yiiwheels.widgets.gallery.WhGallery', array('items' => $items));?>
<?php $this->widget('yiiwheels.widgets.gallery.WhCarousel', array('items' => $items));?>
<?php $videoItems = array(
array(
'title' => 'Sintel',
'href' => 'http://media.w3.org/2010/05/sintel/trailer.mp4',
'type' => 'video/mp4',
'poster' => 'http://media.w3.org/2010/05/sintel/poster.png'
),
array(
'title' => 'Big Buck Bunny',
'href' => 'http://upload.wikimedia.org/wikipedia/commons/7/75/Big_Buck_Bunny_Trailer_400p.ogg',
'type' => 'video/ogg',
'poster' => 'http://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Big.Buck.Bunny.-.Opening.Screen.png/800px-Big.Buck.Bunny.-.Opening.Screen.png'
),
array(
'title' => 'Elephants Dream',
'href' => 'http://upload.wikimedia.org/wikipedia/commons/transcoded/8/83/Elephants_Dream_%28high_quality%29.ogv/Elephants_Dream_%28high_quality%29.ogv.360p.webm',
'type' => 'video/webm',
'poster' => 'http://upload.wikimedia.org/wikipedia/commons/thumb/9/90/Elephants_Dream_s1_proog.jpg/800px-Elephants_Dream_s1_proog.jpg'
),
);?>
<?php $this->widget('yiiwheels.widgets.gallery.WhVideoCarousel', array('items' => $videoItems));?>
<?php $this->widget('bootstrap.widgets.TbModal', array(
'id' => 'myModal',
'header' => 'Modal Heading',
'content' => '<p>One fine body...</p>',
'footer' => implode(' ', array(
TbHtml::button('Save Changes', array(
'data-dismiss' => 'modal',
'color' => TbHtml::BUTTON_COLOR_PRIMARY)
),
TbHtml::button('Close', array('data-dismiss' => 'modal')),
)),
)); ?>
<?php echo TbHtml::button('Click me to open modal', array(
'style' => TbHtml::BUTTON_COLOR_PRIMARY,
'size' => TbHtml::BUTTON_SIZE_LARGE,
'data-toggle' => 'modal',
'data-target' => '#myModal',
)); ?>
Timeago is a jQuery plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). For more information about its jquery plugin functionality and options, please visit http://timeago.yarp.com/.
<?php $this->widget(
'yiiwheels.widgets.timeago.WhTimeAgo',
array(
'date' => '2008-07-17T09:24:17Z'
)
); ?>
TimeAgo comes in two flavours: a widget and a format component. The format component differs from the widget in that it takes a UNIX_TIMESTAMP value, making it perfect to work with database values that are goign to be displayed on a grid.
TimeAgo format component requires that you configure it on your main.php config file. Check how it is configured on this site at its github source code.
<?php $time = strtotime('-1 day'); ?>
<?php echo $time; ?>=
<?php echo Yii::app()->format->timeago($time); ?><br>
<?php $time = strtotime('-1 minute'); ?>
<?php echo $time; ?>=
<?php echo Yii::app()->format->timeago($time); ?>
RangeSlider implements jQRangeSlider, A powerful slider for selecting value ranges, supporting dates and more.
Basic
Editable
Date Range with scales
<?php $this->widget(
'yiiwheels.widgets.rangeslider.WhRangeSlider',
array(
'id' => 'rangesliderbasictest',
'name' => 'rangesliderbasictest',
'delayOut' => 4000,
)
);?>
<p>Basic</p>
<br>
<?php $this->widget(
'yiiwheels.widgets.rangeslider.WhRangeSlider',
array(
'id' => 'rangeslidereditabletest',
'name' => 'rangeslidereditabletest',
'delayOut' => 4000,
'type' => 'editRange'
)
);?>
<p>Editable</p>
<?php
$months = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec");
$this->widget(
'yiiwheels.widgets.rangeslider.WhRangeSlider',
array(
'id' => 'rangesliderdatetest',
'name' => 'rangesliderdatetest',
'delayOut' => 4000,
'type' => 'dateRange',
'scales' => array(array(
'first' => 'js: function(value){return value;}',
'end' => 'js: function(value){return value;}',
'next' => 'js: function(value){
var next = new Date(value);
return new Date(next.setMonth(value.getMonth() + 1));
}',
'label' => 'js: function(value){
var months = [
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sept", "Oct", "Nov", "Dec"
];
return months[value.getMonth()];
}',
'format' => 'js: function(tickContainer, tickStart, tickEnd){
tickContainer.addClass("myCustomClass");
}'
)),
'pluginOptions' => array(
'bounds' => array(
'min' => 'js: new Date(2012, 0, 1)',
'max' => 'js: new Date(2012, 11, 31, 12, 59, 59)'
),
'defaultValues' => array(
'min' => 'js:new Date(2012, 1, 10)',
'max' => 'js:new Date(2012, 4, 22)'
),
)
)
);?>
<p>Date Range <small>with scales</small></p>