Fixes #863: adjusted horizontal form layout

This commit is contained in:
Qiang Xue 2013-09-09 21:27:58 -04:00
parent 0f5aac1e21
commit 7c1050460c
2 changed files with 12 additions and 11 deletions

View File

@ -36,7 +36,7 @@ app\config\AppAsset::register($this);
array('label' => 'Contact', 'url' => array('/site/contact')), array('label' => 'Contact', 'url' => array('/site/contact')),
Yii::$app->user->isGuest ? Yii::$app->user->isGuest ?
array('label' => 'Login', 'url' => array('/site/login')) : array('label' => 'Login', 'url' => array('/site/login')) :
array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')), array('label' => 'Logout (' . Html::encode(Yii::$app->user->identity->username) .')' , 'url' => array('/site/logout')),
), ),
)); ));
NavBar::end(); NavBar::end();

View File

@ -19,23 +19,24 @@ $this->params['breadcrumbs'][] = $this->title;
'id' => 'login-form', 'id' => 'login-form',
'options' => array('class' => 'form-horizontal'), 'options' => array('class' => 'form-horizontal'),
'fieldConfig' => array( 'fieldConfig' => array(
'template' => "<div class=\"col-lg-1\">{label}</div>\n<div class=\"col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>", 'template' => "{label}\n<div class=\"col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>",
'labelOptions' => array('class' => 'col-lg-1 control-label'),
), ),
)); ?> )); ?>
<?php echo $form->field($model, 'username'); ?> <?php echo $form->field($model, 'username'); ?>
<?php echo $form->field($model, 'password')->passwordInput(); ?> <?php echo $form->field($model, 'password')->passwordInput(); ?>
<?php echo $form->field($model, 'rememberMe', array( <?php echo $form->field($model, 'rememberMe', array(
'template' => "<div class=\"col-lg-offset-1 col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>", 'template' => "<div class=\"col-lg-offset-1 col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>",
))->checkbox(); ?> ))->checkbox(); ?>
<div class="form-group"> <div class="form-group">
<div class="col-lg-offset-1 col-lg-11"> <div class="col-lg-offset-1 col-lg-11">
<?php echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?> <?php echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?>
</div>
</div> </div>
</div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>