Views match Yii2 View Code Style

close #18
This commit is contained in:
Alex Solomaha 2015-07-09 12:47:20 +03:00 committed by Carsten Brandt
parent 038192fe50
commit 72c2d75419
6 changed files with 108 additions and 88 deletions

View File

@ -1,13 +1,14 @@
<?php <?php
/* @var $this \yii\web\View */
/* @var $content string */
use yii\helpers\Html; use yii\helpers\Html;
use yii\bootstrap\Nav; use yii\bootstrap\Nav;
use yii\bootstrap\NavBar; use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs; use yii\widgets\Breadcrumbs;
use app\assets\AppAsset; use app\assets\AppAsset;
/* @var $this \yii\web\View */
/* @var $content string */
AppAsset::register($this); AppAsset::register($this);
?> ?>
<?php $this->beginPage() ?> <?php $this->beginPage() ?>
@ -21,8 +22,8 @@ AppAsset::register($this);
<?php $this->head() ?> <?php $this->head() ?>
</head> </head>
<body> <body>
<?php $this->beginBody() ?> <?php $this->beginBody() ?>
<div class="wrap"> <div class="wrap">
<?php <?php
NavBar::begin([ NavBar::begin([
@ -40,9 +41,11 @@ AppAsset::register($this);
['label' => 'Contact', 'url' => ['/site/contact']], ['label' => 'Contact', 'url' => ['/site/contact']],
Yii::$app->user->isGuest ? Yii::$app->user->isGuest ?
['label' => 'Login', 'url' => ['/site/login']] : ['label' => 'Login', 'url' => ['/site/login']] :
['label' => 'Logout (' . Yii::$app->user->identity->username . ')', [
'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
'url' => ['/site/logout'], 'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post']], 'linkOptions' => ['data-method' => 'post']
],
], ],
]); ]);
NavBar::end(); NavBar::end();
@ -59,6 +62,7 @@ AppAsset::register($this);
<footer class="footer"> <footer class="footer">
<div class="container"> <div class="container">
<p class="pull-left">&copy; My Company <?= date('Y') ?></p> <p class="pull-left">&copy; My Company <?= date('Y') ?></p>
<p class="pull-right"><?= Yii::powered() ?></p> <p class="pull-right"><?= Yii::powered() ?></p>
</div> </div>
</footer> </footer>

View File

@ -1,7 +1,9 @@
<?php <?php
use yii\helpers\Html;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
use yii\helpers\Html;
$this->title = 'About'; $this->title = 'About';
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>

View File

@ -1,12 +1,13 @@
<?php <?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */ /* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\ContactForm */ /* @var $model app\models\ContactForm */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;
$this->title = 'Contact'; $this->title = 'Contact';
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>
@ -33,23 +34,33 @@ $this->params['breadcrumbs'][] = $this->title;
<?php else: ?> <?php else: ?>
<p> <p>
If you have business inquiries or other questions, please fill out the following form to contact us. Thank you. If you have business inquiries or other questions, please fill out the following form to contact us.
Thank you.
</p> </p>
<div class="row"> <div class="row">
<div class="col-lg-5"> <div class="col-lg-5">
<?php $form = ActiveForm::begin(['id' => 'contact-form']); ?> <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
<?= $form->field($model, 'name') ?> <?= $form->field($model, 'name') ?>
<?= $form->field($model, 'email') ?> <?= $form->field($model, 'email') ?>
<?= $form->field($model, 'subject') ?> <?= $form->field($model, 'subject') ?>
<?= $form->field($model, 'body')->textArea(['rows' => 6]) ?> <?= $form->field($model, 'body')->textArea(['rows' => 6]) ?>
<?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [ <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>', 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
]) ?> ]) ?>
<div class="form-group"> <div class="form-group">
<?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?> <?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
</div> </div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div> </div>
</div> </div>

View File

@ -1,12 +1,12 @@
<?php <?php
use yii\helpers\Html;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $name string */ /* @var $name string */
/* @var $message string */ /* @var $message string */
/* @var $exception Exception */ /* @var $exception Exception */
use yii\helpers\Html;
$this->title = $name; $this->title = $name;
?> ?>
<div class="site-error"> <div class="site-error">

View File

@ -1,5 +1,7 @@
<?php <?php
/* @var $this yii\web\View */ /* @var $this yii\web\View */
$this->title = 'My Yii Application'; $this->title = 'My Yii Application';
?> ?>
<div class="site-index"> <div class="site-index">

View File

@ -1,11 +1,12 @@
<?php <?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */ /* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\LoginForm */ /* @var $model app\models\LoginForm */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
$this->title = 'Login'; $this->title = 'Login';
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>