Commit b44a2085 by Crisu83

updated gii templates (fixes #35)

parent 9248d8d8
<?php <?php
/** /**
* BootCrudCode class file. * BootstrapCode class file.
* @author Christoffer Niska <ChristofferNiska@gmail.com> * @author Christoffer Niska <ChristofferNiska@gmail.com>
* @copyright Copyright &copy; Christoffer Niska 2011- * @copyright Copyright &copy; Christoffer Niska 2011-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*/ */
Yii::import('gii.generators.crud.CrudCode'); Yii::import('gii.generators.crud.CrudCode');
class BootstrapCode extendS CrudCode class BootstrapCode extendS CrudCode
{ {
public function generateActiveRow($modelClass, $column) public function generateActiveRow($modelClass, $column)
......
<?php <?php
/** /**
* BootCrudGenerator class file. * BootstrapGenerator class file.
* @author Christoffer Niska <ChristofferNiska@gmail.com> * @author Christoffer Niska <ChristofferNiska@gmail.com>
* @copyright Copyright &copy; Christoffer Niska 2011- * @copyright Copyright &copy; Christoffer Niska 2011-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*/ */
Yii::import('gii.generators.crud.CrudGenerator'); Yii::import('gii.generators.crud.CrudGenerator');
class BootstrapGenerator extends CrudGenerator class BootstrapGenerator extends CrudGenerator
{ {
public $codeModel = 'bootstrap.gii.bootstrap.BootstrapCode'; public $codeModel = 'bootstrap.gii.bootstrap.BootstrapCode';
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* - $this: the BootCrudCode object * - $this: the BootCrudCode object
*/ */
?> ?>
<?php echo "<?php \$form=\$this->beginWidget('ext.bootstrap.widgets.BootActiveForm',array( <?php echo "<?php \$form=\$this->beginWidget('bootstrap.widgets.BootActiveForm',array(
'id'=>'".$this->class2id($this->modelClass)."-form', 'id'=>'".$this->class2id($this->modelClass)."-form',
'enableAjaxValidation'=>false, 'enableAjaxValidation'=>false,
)); ?>\n"; ?> )); ?>\n"; ?>
...@@ -24,8 +24,11 @@ foreach($this->tableSchema->columns as $column) ...@@ -24,8 +24,11 @@ foreach($this->tableSchema->columns as $column)
<?php <?php
} }
?> ?>
<div class="actions"> <div class="form-actions">
<?php echo "<?php echo CHtml::submitButton(\$model->isNewRecord ? 'Create' : 'Save',array('class'=>'btn primary')); ?>\n"; ?> <?php echo "<?php \$this->widget('bootstrap.widgets.BootButton', array(
'type'=>'primary',
'label'=>\$model->isNewRecord ? 'Create' : 'Save',
)); ?>\n"; ?>
</div> </div>
<?php echo "<?php \$this->endWidget(); ?>\n"; ?> <?php echo "<?php \$this->endWidget(); ?>\n"; ?>
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* - $this: the BootCrudCode object * - $this: the BootCrudCode object
*/ */
?> ?>
<?php echo "<?php \$form=\$this->beginWidget('ext.bootstrap.widgets.BootActiveForm',array( <?php echo "<?php \$form=\$this->beginWidget('bootstrap.widgets.BootActiveForm',array(
'action'=>Yii::app()->createUrl(\$this->route), 'action'=>Yii::app()->createUrl(\$this->route),
'method'=>'get', 'method'=>'get',
)); ?>\n"; ?> )); ?>\n"; ?>
...@@ -18,8 +18,11 @@ ...@@ -18,8 +18,11 @@
<?php echo "<?php echo ".$this->generateActiveRow($this->modelClass,$column)."; ?>\n"; ?> <?php echo "<?php echo ".$this->generateActiveRow($this->modelClass,$column)."; ?>\n"; ?>
<?php endforeach; ?> <?php endforeach; ?>
<div class="actions"> <div class="form-actions">
<?php echo "<?php echo CHtml::submitButton('Search',array('class'=>'btn primary')); ?>\n"; ?> <?php echo "<?php \$this->widget('bootstrap.widgets.BootButton', array(
'type'=>'primary',
'label'=>'Search',
)); ?>\n"; ?>
</div> </div>
<?php echo "<?php \$this->endWidget(); ?>\n"; ?> <?php echo "<?php \$this->endWidget(); ?>\n"; ?>
\ No newline at end of file
...@@ -47,7 +47,7 @@ or <b>=</b>) at the beginning of each of your search values to specify how the c ...@@ -47,7 +47,7 @@ or <b>=</b>) at the beginning of each of your search values to specify how the c
)); ?>\n"; ?> )); ?>\n"; ?>
</div><!-- search-form --> </div><!-- search-form -->
<?php echo "<?php"; ?> $this->widget('ext.bootstrap.widgets.BootGridView',array( <?php echo "<?php"; ?> $this->widget('bootstrap.widgets.BootGridView',array(
'id'=>'<?php echo $this->class2id($this->modelClass); ?>-grid', 'id'=>'<?php echo $this->class2id($this->modelClass); ?>-grid',
'dataProvider'=>$model->search(), 'dataProvider'=>$model->search(),
'filter'=>$model, 'filter'=>$model,
...@@ -64,7 +64,7 @@ if($count>=7) ...@@ -64,7 +64,7 @@ if($count>=7)
echo "\t\t*/\n"; echo "\t\t*/\n";
?> ?>
array( array(
'class'=>'CButtonColumn', 'class'=>'BootButtonColumn',
), ),
), ),
)); ?> )); ?>
...@@ -20,7 +20,7 @@ $this->menu=array( ...@@ -20,7 +20,7 @@ $this->menu=array(
<h1><?php echo $label; ?></h1> <h1><?php echo $label; ?></h1>
<?php echo "<?php"; ?> $this->widget('ext.bootstrap.widgets.BootListView',array( <?php echo "<?php"; ?> $this->widget('bootstrap.widgets.BootListView',array(
'dataProvider'=>$dataProvider, 'dataProvider'=>$dataProvider,
'itemView'=>'_view', 'itemView'=>'_view',
)); ?> )); ?>
...@@ -25,7 +25,7 @@ $this->menu=array( ...@@ -25,7 +25,7 @@ $this->menu=array(
<h1>View <?php echo $this->modelClass." #<?php echo \$model->{$this->tableSchema->primaryKey}; ?>"; ?></h1> <h1>View <?php echo $this->modelClass." #<?php echo \$model->{$this->tableSchema->primaryKey}; ?>"; ?></h1>
<?php echo "<?php"; ?> $this->widget('ext.bootstrap.widgets.BootDetailView',array( <?php echo "<?php"; ?> $this->widget('bootstrap.widgets.BootDetailView',array(
'data'=>$model, 'data'=>$model,
'attributes'=>array( 'attributes'=>array(
<?php <?php
......
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