Commits

Christoffer Niska committed bb05f21

Updated the test page.

Comments (0)

Files changed (5)

bootstrap/widgets/BootGridView.php

 class BootGridView extends CGridView
 {
 	/**
-	 * @var string the CSS class name for the container table.
-	 * Defaults to 'table'.
+	 * @var boolean whether to display the table even when there is no data. Defaults to false.
+	 */
+	public $showTableOnEmpty = false;
+
+	/**
+	 * @var string the CSS class name for the container table. Defaults to 'table'.
 	 */
 	public $itemsCssClass = 'table';
 	/**

demo/less/styles.less

 	padding-bottom: 40px;
 }
 
-h1, h2, h3 {
+h1, h2, h3, h4, h5, h6 {
 	margin-bottom: 0.6em;
 }
 
 }
 
 #bootNavbar .navbar-inner > .container {
-	width: 660px;
+	width: 740px;
+}
+
+#bootThumbs .list-view {
+	padding-top: 30px;
 }

demo/protected/controllers/SiteController.php

 class SiteController extends Controller
 {
 	/**
-	 * Declares class-based actions.
-	 */
-	public function actions()
-	{
-		return array(
-			// captcha action renders the CAPTCHA image displayed on the contact page
-			'captcha'=>array(
-				'class'=>'CCaptchaAction',
-				'backColor'=>0xFFFFFF,
-			),
-			// page action renders "static" pages stored under 'protected/views/site/pages'
-			// They can be accessed via: index.php?r=site/page&view=FileName
-			'page'=>array(
-				'class'=>'CViewAction',
-			),
-		);
-	}
-
-	/**
 	 * This is the default 'index' action that is invoked
 	 * when an action is not explicitly requested by users.
 	 */
 	public function actionIndex()
 	{
-		// renders the view file 'protected/views/site/index.php'
-		// using the default layout 'protected/views/layouts/main.php'
-		$this->render('index');
+		$gridDataProvider = new CArrayDataProvider(array(
+			array('id'=>1, 'firstName'=>'Mark', 'lastName'=>'Otto', 'language'=>'CSS'),
+			array('id'=>2, 'firstName'=>'Jacob', 'lastName'=>'Thornton', 'language'=>'JavaScript'),
+			array('id'=>3, 'firstName'=>'Stu', 'lastName'=>'Dent', 'language'=>'HTML'),
+		));
+
+		$gridColumns = array(
+			array('name'=>'id', 'header'=>'#'),
+			array('name'=>'firstName', 'header'=>'First name'),
+			array('name'=>'lastName', 'header'=>'Last name'),
+			array('name'=>'language', 'header'=>'Language'),
+			array(
+				'class'=>'BootButtonColumn',
+				'viewButtonUrl'=>null,
+				'viewButtonOptions'=>array('rel'=>'tooltip'),
+				'updateButtonUrl'=>null,
+				'updateButtonOptions'=>array('rel'=>'tooltip'),
+				'deleteButtonUrl'=>null,
+				'deleteButtonOptions'=>array('rel'=>'tooltip'),
+			)
+		);
+
+		$rawData = array();
+		for ($i = 0; $i < 200; $i++)
+			$rawData[] = array('id'=>$i + 1);
+
+		$listDataProvider = new CArrayDataProvider($rawData, array(
+			'pagination'=>array('pageSize'=>10),
+		));
+
+		$this->render('index', array(
+			'gridDataProvider'=>$gridDataProvider,
+			'gridColumns'=>$gridColumns,
+			'listDataProvider'=>$listDataProvider,
+		));
 	}
 
 	/**
 	        	$this->render('error', $error);
 	    }
 	}
-
-	/**
-	 * Displays the contact page
-	 */
-	public function actionContact()
-	{
-		$model=new ContactForm;
-
-		// if it is ajax validation request
-		if(isset($_POST['ajax']) && $_POST['ajax']==='contact-form')
-		{
-			echo CActiveForm::validate($model);
-			Yii::app()->end();
-		}
-
-		if(isset($_POST['ContactForm']))
-		{
-			$model->attributes=$_POST['ContactForm'];
-			if($model->validate())
-			{
-				$headers="From: {$model->email}\r\nReply-To: {$model->email}";
-				mail(Yii::app()->params['adminEmail'],$model->subject,$model->body,$headers);
-				Yii::app()->user->setFlash('contact','Thank you for contacting us. We will respond to you as soon as possible.');
-				$this->refresh();
-			}
-		}
-		$this->render('contact',array('model'=>$model));
-	}
-
-	/**
-	 * Displays the login page
-	 */
-	public function actionLogin()
-	{
-		$model=new LoginForm;
-
-		// if it is ajax validation request
-		if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
-		{
-			echo CActiveForm::validate($model);
-			Yii::app()->end();
-		}
-
-		// collect user input data
-		if(isset($_POST['LoginForm']))
-		{
-			$model->attributes=$_POST['LoginForm'];
-			// validate user input and redirect to the previous page if valid
-			if($model->validate() && $model->login())
-				$this->redirect(Yii::app()->user->returnUrl);
-		}
-		// display the login form
-		$this->render('login',array('model'=>$model));
-	}
-
-	/**
-	 * Logs out the current user and redirect to homepage.
-	 */
-	public function actionLogout()
-	{
-		Yii::app()->user->logout();
-		$this->redirect(Yii::app()->homeUrl);
-	}
 }

demo/protected/views/site/_thumb.php

+<li class="span2">
+	<a href="#" class="thumbnail">
+		<img src="http://placehold.it/160x120" alt="">
+	</a>
+</li>

demo/protected/views/site/index.php

 
 <div class="row">
 
-	<div class="span9">
+	<div class="span10">
 
 		<div id="bootActiveForm">
 
 
 			<h3>BootAlert</h3>
 
-			<?php Yii::app()->user->setFlash('success', 'Success!'); ?>
-			<?php Yii::app()->user->setFlash('warning', 'This is a warning.'); ?>
-			<?php Yii::app()->user->setFlash('info', 'Attention!'); ?>
-			<?php Yii::app()->user->setFlash('error', 'This is an error.'); ?>
+			<?php Yii::app()->user->setFlash('success', '<strong>Well done!</strong> You successfully read this important alert message.'); ?>
+			<?php Yii::app()->user->setFlash('info', '<strong>Heads up!</strong> This alert needs your attention, but it\'s not super important.'); ?>
+			<?php Yii::app()->user->setFlash('warning', '<strong>Warning!</strong> Best check yo self, you\'re not looking too good.'); ?>
+			<?php Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few things up and try submitting again.'); ?>
 
-			<?php $this->widget('BootAlert',array(
+			<?php $this->widget('BootAlert', array(
 				'options'=>array('displayTime'=>0),
 			)); ?>
 
 
 			<h3>BootMenu</h3>
 
-			<h5>Tabs</h5>
+			<h4>Tabs</h4>
 
-			<?php $this->widget('BootMenu', array(
-				'type'=>'tabs',
-				'items'=>array(
-					array('label'=>'Home', 'url'=>'#', 'active'=>true),
-					array('label'=>'Profile', 'url'=>'#'),
-					array('label'=>'Dropdown', 'items'=>array(
-						array('label'=>'Secondary link', 'url'=>'#'),
-						array('label'=>'Something else here', 'url'=>'#'),
-						'---',
-						array('label'=>'Another link', 'url'=>'#'),
-					)),
-					array('label'=>'Messages', 'url'=>'#'),
-				),
-			)); ?>
+			<div class="row">
 
-			<h5>Pills (Stacked)</h5>
+				<div class="span5">
 
-			<?php $this->widget('BootMenu', array(
-				'type'=>'pills',
-				'stacked'=>true,
-				'items'=>array(
-					array('label'=>'Home', 'url'=>'#', 'active'=>true),
-					array('label'=>'Profile', 'url'=>'#'),
-					array('label'=>'Dropdown', 'items'=>array(
-						array('label'=>'Secondary link', 'url'=>'#'),
-						array('label'=>'Something else here', 'url'=>'#'),
-						'---',
-						array('label'=>'Another link', 'url'=>'#'),
-					)),
-					array('label'=>'Messages', 'url'=>'#'),
-				),
-			)); ?>
+					<?php $this->widget('BootMenu', array(
+						'type'=>'tabs',
+						'items'=>array(
+							array('label'=>'Home', 'url'=>'#', 'active'=>true),
+							array('label'=>'Profile', 'url'=>'#'),
+							array('label'=>'Dropdown', 'items'=>array(
+								array('label'=>'Secondary link', 'url'=>'#'),
+								array('label'=>'Something else here', 'url'=>'#'),
+								'---',
+								array('label'=>'Another link', 'url'=>'#'),
+							)),
+							array('label'=>'Messages', 'url'=>'#'),
+						),
+					)); ?>
 
-			<h5>List</h5>
+				</div>
+
+				<div class="span5">
+
+					<?php $this->widget('BootMenu', array(
+						'type'=>'tabs',
+						'stacked'=>true,
+						'items'=>array(
+							array('label'=>'Home', 'url'=>'#', 'active'=>true),
+							array('label'=>'Profile', 'url'=>'#'),
+							array('label'=>'Dropdown', 'items'=>array(
+								array('label'=>'Secondary link', 'url'=>'#'),
+								array('label'=>'Something else here', 'url'=>'#'),
+								'---',
+								array('label'=>'Another link', 'url'=>'#'),
+							)),
+							array('label'=>'Messages', 'url'=>'#'),
+						),
+					)); ?>
+
+				</div>
+
+			</div>
+
+			<h4>Pills</h4>
+
+			<div class="row">
+
+				<div class="span5">
+
+					<?php $this->widget('BootMenu', array(
+						'type'=>'pills',
+						'items'=>array(
+							array('label'=>'Home', 'url'=>'#', 'active'=>true),
+							array('label'=>'Profile', 'url'=>'#'),
+							array('label'=>'Dropdown', 'items'=>array(
+								array('label'=>'Secondary link', 'url'=>'#'),
+								array('label'=>'Something else here', 'url'=>'#'),
+								'---',
+								array('label'=>'Another link', 'url'=>'#'),
+							)),
+							array('label'=>'Messages', 'url'=>'#'),
+						),
+					)); ?>
+
+				</div>
+
+				<div class="span5">
+
+					<?php $this->widget('BootMenu', array(
+						'type'=>'pills',
+						'stacked'=>true,
+						'items'=>array(
+							array('label'=>'Home', 'url'=>'#', 'active'=>true),
+							array('label'=>'Profile', 'url'=>'#'),
+							array('label'=>'Dropdown', 'items'=>array(
+								array('label'=>'Secondary link', 'url'=>'#'),
+								array('label'=>'Something else here', 'url'=>'#'),
+								'---',
+								array('label'=>'Another link', 'url'=>'#'),
+							)),
+							array('label'=>'Messages', 'url'=>'#'),
+						),
+					)); ?>
+
+				</div>
+
+			</div>
+
+			<h4>List</h4>
 
 			<div class="well" style="padding: 8px 0;">
 
 		<div id="bootGridView">
 			
 			<h3>BootGridView</h3>
+
+			<h4>Default</h4>
+
+			<?php $this->widget('BootGridView', array(
+				'dataProvider'=>$gridDataProvider,
+				'template'=>"{items}",
+				'itemsCssClass'=>'table',
+				'columns'=>$gridColumns,
+			)); ?>
+
+			<h4>Striped</h4>
+
+			<?php $this->widget('BootGridView', array(
+				'dataProvider'=>$gridDataProvider,
+				'template'=>"{items}",
+				'itemsCssClass'=>'table table-striped',
+				'columns'=>$gridColumns,
+			)); ?>
+
+			<h4>Condensed</h4>
+
+			<?php $this->widget('BootGridView', array(
+				'dataProvider'=>$gridDataProvider,
+				'template'=>"{items}",
+				'itemsCssClass'=>'table table-condensed',
+				'columns'=>$gridColumns,
+			)); ?>
+
+			<h4>Striped and condensed</h4>
+
+			<?php $this->widget('BootGridView', array(
+				'dataProvider'=>$gridDataProvider,
+				'template'=>"{items}",
+				'itemsCssClass'=>'table table-striped table-condensed',
+				'columns'=>$gridColumns,
+			)); ?>
 			
-			<p>@todo</p>
-			
-		</div>
-
-		<hr />
-
-		<div id="bootListView">
-
-			<h3>BootListView</h3>
-
-			<p>@todo</p>
-
 		</div>
 
 		<hr />
 
 			<h3>BootThumbs</h3>
 
-			<p>@todo</p>
+			<?php $this->widget('BootThumbs', array(
+				'dataProvider'=>$listDataProvider,
+				'template'=>"{items}\n{pager}",
+				'itemView'=>'_thumb',
+			)); ?>
 
 		</div>
 
 
 	</div>
 
-	<div class="span3">
+	<div class="span2">
 
 		<div class="well" style="padding: 8px 0;">
 
 					array('label'=>'BootTabbed','url'=>'#bootTabbed'),
 					array('label'=>'BootDetailView','url'=>'#bootDetailView'),
 					array('label'=>'BootGridView','url'=>'#bootGridView'),
-					array('label'=>'BootListView','url'=>'#bootListView'),
 					array('label'=>'BootThumbs','url'=>'#bootThumbs'),
 					array('label'=>'BootTooltip','url'=>'#bootTooltip'),
 					array('label'=>'BootPopover','url'=>'#bootPopover'),