Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
test-project
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Junaid Rahman pv
test-project
Commits
44ccbb66
Commit
44ccbb66
authored
Aug 31, 2016
by
dianc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Category Updated
parent
38ee261d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
19 deletions
+41
-19
CategoryController.php
backend/modules/theme/controllers/CategoryController.php
+11
-0
_form.php
backend/modules/theme/views/category/_form.php
+27
-15
Category.php
common/models/Category.php
+3
-4
No files found.
backend/modules/theme/controllers/CategoryController.php
View file @
44ccbb66
...
@@ -5,6 +5,8 @@ namespace backend\modules\theme\controllers;
...
@@ -5,6 +5,8 @@ namespace backend\modules\theme\controllers;
use
Yii
;
use
Yii
;
use
common\models\Category
;
use
common\models\Category
;
use
backend\modules\theme\models\search\CategorySearch
;
use
backend\modules\theme\models\search\CategorySearch
;
use
yii\behaviors\SluggableBehavior
;
use
yii\behaviors\TimestampBehavior
;
use
yii\web\Controller
;
use
yii\web\Controller
;
use
yii\web\NotFoundHttpException
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
use
yii\filters\VerbFilter
;
...
@@ -23,6 +25,15 @@ class CategoryController extends Controller
...
@@ -23,6 +25,15 @@ class CategoryController extends Controller
'delete'
=>
[
'post'
],
'delete'
=>
[
'post'
],
],
],
],
],
[
'class'
=>
SluggableBehavior
::
className
(),
'attribute'
=>
'name'
,
],
[
'class'
=>
TimestampBehavior
::
className
(),
'createdAtAttribute'
=>
'created_at'
,
'updatedAtAttribute'
=>
'updated_at'
]
];
];
}
}
...
...
backend/modules/theme/views/category/_form.php
View file @
44ccbb66
...
@@ -13,22 +13,34 @@ use yii\bootstrap\ActiveForm;
...
@@ -13,22 +13,34 @@ use yii\bootstrap\ActiveForm;
<?php
$form
=
ActiveForm
::
begin
();
?>
<?php
$form
=
ActiveForm
::
begin
();
?>
<?php
echo
$form
->
errorSummary
(
$model
);
?>
<?php
echo
$form
->
errorSummary
(
$model
);
?>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?php
echo
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
<div
class=
"col-md-3"
>
<?php
echo
$form
->
field
(
$model
,
'description'
)
->
textarea
([
'maxlength'
=>
true
])
?>
</div>
</div>
<?php
echo
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?php
echo
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
<?php
echo
$form
->
field
(
$model
,
'description'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<div
class=
"col-md-3"
>
<?=
$form
->
field
(
$model
,
'status'
)
->
dropDownList
(
$model
::
statuses
(),
[
'prompt'
=>
''
])
?>
<?php
echo
$form
->
field
(
$model
,
'image_url'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
</div>
<?php
echo
$form
->
field
(
$model
,
'image_path'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?php
echo
$form
->
field
(
$model
,
'status'
)
->
textInput
()
?>
<?=
$form
->
field
(
$model
,
'image_url'
)
->
widget
(
\trntv\filekit\widget\Upload
::
className
(),
<?php
echo
$form
->
field
(
$model
,
'created_at'
)
->
textInput
()
?>
[
'url'
=>
[
'/file-storage/upload'
],
<?php
echo
$form
->
field
(
$model
,
'updated_at'
)
->
textInput
()
?>
])
->
label
(
'Image(1280x854)'
);
?>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<?php
echo
Html
::
submitButton
(
$model
->
isNewRecord
?
Yii
::
t
(
'backend'
,
'Create'
)
:
Yii
::
t
(
'backend'
,
'Update'
),
[
'class'
=>
$model
->
isNewRecord
?
'btn btn-success'
:
'btn btn-primary'
])
?>
<?php
echo
Html
::
submitButton
(
$model
->
isNewRecord
?
Yii
::
t
(
'backend'
,
'Create'
)
:
Yii
::
t
(
'backend'
,
'Update'
),
[
'class'
=>
$model
->
isNewRecord
?
'btn btn-success'
:
'btn btn-primary'
])
?>
...
...
common/models/Category.php
View file @
44ccbb66
...
@@ -23,8 +23,8 @@ use common\models\query\CategoryQuery;
...
@@ -23,8 +23,8 @@ use common\models\query\CategoryQuery;
class
Category
extends
\yii\db\ActiveRecord
class
Category
extends
\yii\db\ActiveRecord
{
{
const
STATUS_ACTIVE
=
1
;
const
STATUS_ACTIVE
=
1
;
const
STATUS_
NOT
_ACTIVE
=
2
;
const
STATUS_
IN
_ACTIVE
=
2
;
const
STATUS_DELETED
=
3
;
/**
/**
* @inheritdoc
* @inheritdoc
...
@@ -87,8 +87,7 @@ class Category extends \yii\db\ActiveRecord
...
@@ -87,8 +87,7 @@ class Category extends \yii\db\ActiveRecord
{
{
return
[
return
[
self
::
STATUS_ACTIVE
=>
Yii
::
t
(
'common'
,
'Active'
),
self
::
STATUS_ACTIVE
=>
Yii
::
t
(
'common'
,
'Active'
),
self
::
STATUS_NOT_ACTIVE
=>
Yii
::
t
(
'common'
,
'Not Active'
),
self
::
STATUS_IN_ACTIVE
=>
Yii
::
t
(
'common'
,
'In Active'
),
self
::
STATUS_DELETED
=>
Yii
::
t
(
'common'
,
'Deleted'
)
];
];
}
}
}
}
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