Browse Source

Fixes #863: adjusted horizontal form layout

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
347e79a467
  1. 2
      apps/basic/views/layouts/main.php
  2. 21
      apps/basic/views/site/login.php
  3. 31
      framework/yii/gii/generators/crud/templates/views/_view.php

2
apps/basic/views/layouts/main.php

@ -36,7 +36,7 @@ app\config\AppAsset::register($this);
array('label' => 'Contact', 'url' => array('/site/contact')),
Yii::$app->user->isGuest ?
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();

21
apps/basic/views/site/login.php

@ -19,23 +19,24 @@ $this->params['breadcrumbs'][] = $this->title;
'id' => 'login-form',
'options' => array('class' => 'form-horizontal'),
'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(
'template' => "<div class=\"col-lg-offset-1 col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>",
))->checkbox(); ?>
<?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>",
))->checkbox(); ?>
<div class="form-group">
<div class="col-lg-offset-1 col-lg-11">
<?php echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?>
</div>
<div class="form-group">
<div class="col-lg-offset-1 col-lg-11">
<?php echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?>
</div>
</div>
<?php ActiveForm::end(); ?>

31
framework/yii/gii/generators/crud/templates/views/_view.php

@ -1,31 +0,0 @@
<?php
/**
* The following variables are available in this template:
* - $this: the CrudCode object
*/
?>
<?php echo "<?php\n"; ?>
/* @var $this <?php echo $this->getControllerClass(); ?> */
/* @var $data <?php echo $this->getModelClass(); ?> */
?>
<div class="view">
<?php
echo "\t<b><?php echo CHtml::encode(\$data->getAttributeLabel('{$this->tableSchema->primaryKey}')); ?>:</b>\n";
echo "\t<?php echo CHtml::link(CHtml::encode(\$data->{$this->tableSchema->primaryKey}), array('view', 'id'=>\$data->{$this->tableSchema->primaryKey})); ?>\n\t<br />\n\n";
$count=0;
foreach($this->tableSchema->columns as $column)
{
if($column->isPrimaryKey)
continue;
if(++$count==7)
echo "\t<?php /*\n";
echo "\t<b><?php echo CHtml::encode(\$data->getAttributeLabel('{$column->name}')); ?>:</b>\n";
echo "\t<?php echo CHtml::encode(\$data->{$column->name}); ?>\n\t<br />\n\n";
}
if($count>=7)
echo "\t*/ ?>\n";
?>
</div>
Loading…
Cancel
Save