Commit 0d182ace by Qiang Xue

basic app WIP

parent 91002172
body {
padding-top: 20px;
padding-bottom: 60px;
}
/* Custom container */
.container {
margin: 0 auto;
max-width: 1000px;
}
.container > hr {
margin: 60px 0;
}
/* Main marketing message and sign up button */
.jumbotron {
margin: 80px 0;
text-align: center;
}
.jumbotron h1 {
font-size: 100px;
line-height: 1;
}
.jumbotron .lead {
font-size: 24px;
line-height: 1.25;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
}
/* Supporting marketing content */
.marketing {
margin: 60px 0;
}
.marketing p + h4 {
margin-top: 28px;
}
/* Customize the navbar links to be fill the entire space of the .navbar */
.navbar .navbar-inner {
padding: 0;
}
.navbar .nav {
margin: 0;
display: table;
width: 100%;
}
.navbar .nav li {
display: table-cell;
width: 1%;
float: none;
}
.navbar .nav li a {
font-weight: bold;
text-align: center;
border-left: 1px solid rgba(255, 255, 255, .75);
border-right: 1px solid rgba(0, 0, 0, .1);
}
.navbar .nav li:first-child a {
border-left: 0;
border-radius: 3px 0 0 3px;
}
.navbar .nav li:last-child a {
border-right: 0;
border-radius: 0 3px 3px 0;
}
<?php
return array(
'app' => array(
'basePath' => '@wwwroot',
'baseUrl' => '@www',
'css' => array(
'css/bootstrap.min.css',
'css/bootstrap-responsive.min.css',
'css/site.css',
),
'js' => array(
),
'depends' => array(
'yii',
),
),
);
\ No newline at end of file
...@@ -10,6 +10,9 @@ return array( ...@@ -10,6 +10,9 @@ return array(
'user' => array( 'user' => array(
'class' => 'yii\web\User', 'class' => 'yii\web\User',
'identityClass' => 'app\models\User', 'identityClass' => 'app\models\User',
) ),
'assetManager' => array(
'bundles' => require(__DIR__ . '/assets.php'),
),
), ),
); );
\ No newline at end of file
...@@ -27,4 +27,14 @@ class SiteController extends Controller ...@@ -27,4 +27,14 @@ class SiteController extends Controller
Yii::$app->getUser()->logout(); Yii::$app->getUser()->logout();
Yii::$app->getResponse()->redirect(array('site/index')); Yii::$app->getResponse()->redirect(array('site/index'));
} }
public function actionContact()
{
echo $this->render('contact');
}
public function actionAbout()
{
echo $this->render('about');
}
} }
\ No newline at end of file
...@@ -4,23 +4,52 @@ ...@@ -4,23 +4,52 @@
* @var $content string * @var $content string
*/ */
use yii\helpers\Html; use yii\helpers\Html;
$this->registerAssetBundle('app');
?> ?>
<?php $this->beginPage(); ?> <?php $this->beginPage(); ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8"/>
<title><?php echo Html::encode($this->title); ?></title> <title><?php echo Html::encode($this->title); ?></title>
<?php echo Html::cssFile("css/bootstrap.min.css", array('media' => 'screen')); ?>
<?php $this->head(); ?> <?php $this->head(); ?>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<h1>Welcome</h1> <?php $this->beginBody(); ?>
<?php $this->beginBody(); ?> <div class="masthead">
<?php echo $content; ?> <h3 class="muted">My Company</h3>
<?php $this->endBody(); ?>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<ul class="nav">
<li><?php echo Html::a('Home', Yii::$app->homeUrl); ?></li>
<li><?php echo Html::a('About', array('/site/about')); ?></li>
<li><?php echo Html::a('Contact', array('/site/contact')); ?></li>
<?php if (Yii::$app->user->isGuest): ?>
<li><?php echo Html::a('Login', array('/site/login')); ?></li>
<?php else: ?>
<li><?php echo Html::a('Logout (' . Html::encode(Yii::$app->user->identity->username) . ')', array('/site/logout')); ?></li>
<?php endif; ?>
</ul>
</div>
</div>
</div>
<!-- /.navbar -->
</div> </div>
<?php echo $content; ?>
<div class="footer">
<p>&copy; My Company <?php echo date('Y'); ?></p>
<p>
<?php echo Yii::powered(); ?>
Template by <a href="http://twitter.github.io/bootstrap/">Twitter Bootstrap</a>
</p>
</div>
<?php $this->endBody(); ?>
</div>
</body> </body>
</html> </html>
<?php $this->endPage(); ?> <?php $this->endPage(); ?>
\ No newline at end of file
<?php
use yii\helpers\Html;
/**
* @var yii\base\View $this
*/
$this->title = 'About';
?>
<h1><?php echo Html::encode($this->title); ?></h1>
\ No newline at end of file
<?php
use yii\helpers\Html;
/**
* @var yii\base\View $this
* @var yii\widgets\ActiveForm $form
* @var app\models\ContactForm $model
*/
$this->title = 'Contact';
?>
<h1><?php echo Html::encode($this->title); ?></h1>
<?php <?php
/** @var $this \yii\base\View */ /**
* @var yii\base\View $this
*/
$this->title = 'Welcome';
?>
<div class="jumbotron">
<h1>Marketing stuff!</h1>
use yii\helpers\Html; <p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus
commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<a class="btn btn-large btn-success" href="http://www.yiiframework.com">Get started today</a>
</div>
$this->title = 'Hello World'; <hr>
$user = Yii::$app->getUser(); <!-- Example row of columns -->
if ($user->isGuest) { <div class="row-fluid">
echo Html::a('login', array('login')); <div class="span4">
} else { <h2>Heading</h2>
echo "You are logged in as " . $user->identity->username . "<br/>";
echo Html::a('logout', array('logout')); <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris
} condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod.
?> Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris
condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod.
Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span4">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta
felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum
massa.</p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
</div>
<hr>
...@@ -5,8 +5,9 @@ use yii\helpers\Html; ...@@ -5,8 +5,9 @@ use yii\helpers\Html;
* @var yii\widgets\ActiveForm $form * @var yii\widgets\ActiveForm $form
* @var app\models\LoginForm $model * @var app\models\LoginForm $model
*/ */
$this->title = 'Login';
?> ?>
<h1>Login</h1> <h1><?php echo Html::encode($this->title); ?></h1>
<p>Please fill out the following fields to login:</p> <p>Please fill out the following fields to login:</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment