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
31be3fa5
Commit
31be3fa5
authored
Aug 31, 2016
by
dianc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Category Info and Files Tab
parent
921e71b3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
29 deletions
+52
-29
CategoryController.php
backend/modules/theme/controllers/CategoryController.php
+2
-0
_form.php
backend/modules/theme/views/category/_form.php
+48
-27
base.php
common/config/base.php
+1
-1
Category.php
common/models/Category.php
+1
-1
No files found.
backend/modules/theme/controllers/CategoryController.php
View file @
31be3fa5
...
...
@@ -64,6 +64,8 @@ class CategoryController extends Controller
{
$model
=
new
Category
();
$model
->
status
=
$model
::
STATUS_ACTIVE
;
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
redirect
([
'view'
,
'id'
=>
$model
->
id
]);
}
else
{
...
...
backend/modules/theme/views/category/_form.php
View file @
31be3fa5
...
...
@@ -12,54 +12,75 @@ use trntv\filekit\widget\Upload;
<div
class=
"category-form"
>
<?php
$form
=
ActiveForm
::
begin
();
?>
<?=
$form
->
errorSummary
(
$model
);
?>
<ul
id=
"myTab"
class=
"nav nav-tabs"
>
<li
class=
"active"
>
<a
href=
"#info"
data-toggle=
"tab"
>
Info
</a>
</li>
<li>
<a
href=
"#files"
data-toggle=
"tab"
>
Files
</a>
</li>
</ul>
<div
id=
"myTabContent"
class=
"tab-content"
>
<div
class=
"tab-pane fade in active"
id=
"info"
>
<div
class=
"page-header"
>
<h3>
Info
</h3>
</div>
<div
class=
"row"
>
<div
class=
"col-md-
3
"
>
<?
=
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<div
class=
"col-md-
6
"
>
<?
php
echo
$form
->
field
(
$model
,
'name'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-
3
"
>
<?
=
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<div
class=
"col-md-
6
"
>
<?
php
echo
$form
->
field
(
$model
,
'slug'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-
3
"
>
<?
=
$form
->
field
(
$model
,
'description'
)
->
textarea
([
'maxlength'
=>
true
])
?>
<div
class=
"col-md-
6
"
>
<?
php
echo
$form
->
field
(
$model
,
'description'
)
->
textarea
([
'rows'
=>
'7'
])
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<?=
$form
->
field
(
$model
,
'image'
)
->
widget
(
Upload
::
className
(),
[
'url'
=>
[
'/file-storage/upload'
],
])
->
label
(
'Image'
);
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<?=
$form
->
field
(
$model
,
'image'
)
->
widget
(
Upload
::
className
(),
[
'url'
=>
[
'/file-storage/upload'
],
])
->
label
(
'Image'
);
?>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-3"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<?=
$form
->
field
(
$model
,
'status'
)
->
dropDownList
(
$model
::
statuses
(),
[
'prompt'
=>
''
])
?>
</div>
</div>
<div
class=
"form-group"
>
<?=
Html
::
submitButton
(
$model
->
isNewRecord
?
Yii
::
t
(
'backend'
,
'Create'
)
:
Yii
::
t
(
'backend'
,
'Update'
),
[
'class'
=>
$model
->
isNewRecord
?
'btn btn-success'
:
'btn btn-primary'
])
?>
<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'
])
?>
</div>
</div>
<div
class=
"tab-pane fade in"
id=
"files"
>
<div
class=
"page-header"
>
<h3>
Files
</h3>
</div>
</div>
<?php
ActiveForm
::
end
();
?>
</div>
</div>
common/config/base.php
View file @
31be3fa5
<?php
$config
=
[
'name'
=>
'
Yii2 Starter Kit
'
,
'name'
=>
'
Libromi Web
'
,
'vendorPath'
=>
dirname
(
dirname
(
__DIR__
))
.
'/vendor'
,
'extensions'
=>
require
(
__DIR__
.
'/../../vendor/yiisoft/extensions.php'
),
'sourceLanguage'
=>
'en-US'
,
...
...
common/models/Category.php
View file @
31be3fa5
...
...
@@ -44,7 +44,7 @@ class Category extends \yii\db\ActiveRecord
public
function
rules
()
{
return
[
[[
'name'
,
's
lug'
,
's
tatus'
],
'required'
],
[[
'name'
,
'status'
],
'required'
],
[[
'status'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'name'
,
'slug'
],
'string'
,
'max'
=>
32
],
[[
'description'
],
'string'
,
'max'
=>
512
],
...
...
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