Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
220db270
Commit
220db270
authored
Sep 25, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved crud generator.
parent
f3504f42
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
index.php
framework/yii/gii/generators/crud/templates/views/index.php
+3
-5
view.php
framework/yii/gii/generators/crud/templates/views/view.php
+2
-2
DataColumn.php
framework/yii/grid/DataColumn.php
+9
-2
No files found.
framework/yii/gii/generators/crud/templates/views/index.php
View file @
220db270
...
@@ -30,13 +30,11 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -30,13 +30,11 @@ $this->params['breadcrumbs'][] = $this->title;
<h1>
<?php
echo
"<?php"
;
?>
echo Html::encode($this->title); ?>
</h1>
<h1>
<?php
echo
"<?php"
;
?>
echo Html::encode($this->title); ?>
</h1>
<?php
echo
'<?php'
;
?>
echo $this->render('_search', array('model' => $searchModel)); ?>
<?php
echo
'<?php'
.
(
$generator
->
indexWidgetType
===
'grid'
?
' //'
:
''
)
;
?>
echo $this->render('_search', array('model' => $searchModel)); ?>
<hr>
<p>
<div>
<?php
echo
'<?php'
;
?>
echo Html::a('Create
<?php
echo
StringHelper
::
basename
(
$generator
->
modelClass
);
?>
', array('create'), array('class' => 'btn btn-danger')); ?>
<?php
echo
'<?php'
;
?>
echo Html::a('Create
<?php
echo
StringHelper
::
basename
(
$generator
->
modelClass
);
?>
', array('create'), array('class' => 'btn btn-danger')); ?>
</
div
>
</
p
>
<?php
if
(
$generator
->
indexWidgetType
===
'grid'
)
:
?>
<?php
if
(
$generator
->
indexWidgetType
===
'grid'
)
:
?>
<?php
echo
"<?php"
;
?>
echo GridView::widget(array(
<?php
echo
"<?php"
;
?>
echo GridView::widget(array(
...
...
framework/yii/gii/generators/crud/templates/views/view.php
View file @
220db270
...
@@ -29,14 +29,14 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -29,14 +29,14 @@ $this->params['breadcrumbs'][] = $this->title;
<h1>
<?php
echo
"<?php"
;
?>
echo Html::encode($this->title); ?>
</h1>
<h1>
<?php
echo
"<?php"
;
?>
echo Html::encode($this->title); ?>
</h1>
<
div
>
<
p
>
<?php
echo
'<?php'
;
?>
echo Html::a('Update', array('update',
<?php
echo
$urlParams
;
?>
), array('class' => 'btn btn-danger')); ?>
<?php
echo
'<?php'
;
?>
echo Html::a('Update', array('update',
<?php
echo
$urlParams
;
?>
), array('class' => 'btn btn-danger')); ?>
<?php
echo
'<?php'
;
?>
echo Html::a('Delete', array('delete',
<?php
echo
$urlParams
;
?>
), array(
<?php
echo
'<?php'
;
?>
echo Html::a('Delete', array('delete',
<?php
echo
$urlParams
;
?>
), array(
'class' => 'btn btn-danger',
'class' => 'btn btn-danger',
'data-confirm' => Yii::t('app', 'Are you sure to delete this item?'),
'data-confirm' => Yii::t('app', 'Are you sure to delete this item?'),
'data-method' => 'post',
'data-method' => 'post',
)); ?>
)); ?>
</
div
>
</
p
>
<?php
echo
'<?php'
;
?>
echo DetailView::widget(array(
<?php
echo
'<?php'
;
?>
echo DetailView::widget(array(
'model' => $model,
'model' => $model,
...
...
framework/yii/grid/DataColumn.php
View file @
220db270
...
@@ -68,6 +68,12 @@ class DataColumn extends Column
...
@@ -68,6 +68,12 @@ class DataColumn extends Column
* - If you don't want a filter for this data column, set this value to be false.
* - If you don't want a filter for this data column, set this value to be false.
*/
*/
public
$filter
;
public
$filter
;
/**
* @var array the HTML attributes for the filter input fields. This property is used in combination with
* the [[filter]] property. When [[filter]] is not set or is an array, this property will be used to
* render the HTML attributes for the generated filter input fields.
*/
public
$filterInputOptions
=
array
(
'class'
=>
'form-control'
);
protected
function
renderHeaderCellContent
()
protected
function
renderHeaderCellContent
()
...
@@ -111,9 +117,10 @@ class DataColumn extends Column
...
@@ -111,9 +117,10 @@ class DataColumn extends Column
return
$this
->
filter
;
return
$this
->
filter
;
}
elseif
(
$this
->
filter
!==
false
&&
$this
->
grid
->
filterModel
instanceof
Model
&&
$this
->
attribute
!==
null
)
{
}
elseif
(
$this
->
filter
!==
false
&&
$this
->
grid
->
filterModel
instanceof
Model
&&
$this
->
attribute
!==
null
)
{
if
(
is_array
(
$this
->
filter
))
{
if
(
is_array
(
$this
->
filter
))
{
return
Html
::
activeDropDownList
(
$this
->
grid
->
filterModel
,
$this
->
attribute
,
$this
->
filter
,
array
(
'prompt'
=>
''
));
$options
=
array_merge
(
array
(
'prompt'
=>
''
),
$this
->
filterInputOptions
);
return
Html
::
activeDropDownList
(
$this
->
grid
->
filterModel
,
$this
->
attribute
,
$this
->
filter
,
$options
);
}
else
{
}
else
{
return
Html
::
activeTextInput
(
$this
->
grid
->
filterModel
,
$this
->
attribute
);
return
Html
::
activeTextInput
(
$this
->
grid
->
filterModel
,
$this
->
attribute
,
$this
->
filterInputOptions
);
}
}
}
else
{
}
else
{
return
parent
::
renderFilterCellContent
();
return
parent
::
renderFilterCellContent
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment