Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yii2-widgets2-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
hrzg
yii2-widgets2-module
Commits
85cd720e
Commit
85cd720e
authored
May 19, 2016
by
Tobias Munk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated widget form
parent
e8bd7202
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
69 deletions
+71
-69
Widget.php
src/models/crud/base/Widget.php
+4
-4
_form.php
src/views/crud/widget/_form.php
+65
-34
_create-widget.php
src/views/default/_create-widget.php
+0
-14
index.php
src/views/default/index.php
+0
-15
WidgetContainer.php
src/widgets/WidgetContainer.php
+2
-2
No files found.
src/models/crud/base/Widget.php
View file @
85cd720e
...
@@ -88,8 +88,8 @@ abstract class Widget extends \yii\db\ActiveRecord
...
@@ -88,8 +88,8 @@ abstract class Widget extends \yii\db\ActiveRecord
return
[
return
[
'id'
=>
Yii
::
t
(
'app'
,
'ID'
),
'id'
=>
Yii
::
t
(
'app'
,
'ID'
),
'status'
=>
Yii
::
t
(
'app'
,
'Status'
),
'status'
=>
Yii
::
t
(
'app'
,
'Status'
),
'widget_template_id'
=>
Yii
::
t
(
'app'
,
'
Class Nam
e'
),
'widget_template_id'
=>
Yii
::
t
(
'app'
,
'
Templat
e'
),
'default_properties_json'
=>
Yii
::
t
(
'app'
,
'
Default Properties Json
'
),
'default_properties_json'
=>
Yii
::
t
(
'app'
,
'
Widget Properties
'
),
'name_id'
=>
Yii
::
t
(
'app'
,
'Name ID'
),
'name_id'
=>
Yii
::
t
(
'app'
,
'Name ID'
),
'container_id'
=>
Yii
::
t
(
'app'
,
'Container ID'
),
'container_id'
=>
Yii
::
t
(
'app'
,
'Container ID'
),
'rank'
=>
Yii
::
t
(
'app'
,
'Rank'
),
'rank'
=>
Yii
::
t
(
'app'
,
'Rank'
),
...
@@ -108,7 +108,7 @@ abstract class Widget extends \yii\db\ActiveRecord
...
@@ -108,7 +108,7 @@ abstract class Widget extends \yii\db\ActiveRecord
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
public
function
attributeHints
()
/*
public function attributeHints()
{
{
return array_merge(
return array_merge(
parent::attributeHints(),
parent::attributeHints(),
...
@@ -130,7 +130,7 @@ abstract class Widget extends \yii\db\ActiveRecord
...
@@ -130,7 +130,7 @@ abstract class Widget extends \yii\db\ActiveRecord
'created_at' => Yii::t('app', 'Created At'),
'created_at' => Yii::t('app', 'Created At'),
'updated_at' => Yii::t('app', 'Updated At'),
'updated_at' => Yii::t('app', 'Updated At'),
]);
]);
}
}
*/
}
}
src/views/crud/widget/_form.php
View file @
85cd720e
...
@@ -5,8 +5,11 @@
...
@@ -5,8 +5,11 @@
* @package default
* @package default
*/
*/
namespace
_
;
use
dmstr\bootstrap\Tabs
;
use
dmstr\bootstrap\Tabs
;
use
insolita\wgadminlte\Box
;
use
Yii
;
use
yii\bootstrap\ActiveForm
;
use
yii\bootstrap\ActiveForm
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
...
@@ -23,9 +26,17 @@ use yii\helpers\Html;
...
@@ -23,9 +26,17 @@ use yii\helpers\Html;
<?php
$form
=
ActiveForm
::
begin
([
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'Widget'
,
'id'
=>
'Widget'
,
'layout'
=>
'
horizontal
'
,
'layout'
=>
'
default
'
,
'enableClientValidation'
=>
false
,
'enableClientValidation'
=>
false
,
'errorSummaryCssClass'
=>
'error-summary alert alert-error'
'errorSummaryCssClass'
=>
'error-summary alert alert-error'
,
'fieldConfig'
=>
[
'horizontalCssClasses'
=>
[
'label'
=>
'col-sm-2'
,
'wrapper'
=>
'col-sm-10'
,
'error'
=>
''
,
'hint'
=>
'hidden'
,
]
]
]
]
);
);
...
@@ -67,39 +78,59 @@ JS;
...
@@ -67,39 +78,59 @@ JS;
}
}
}
}
?>
?>
<?php
echo
$form
->
field
(
$model
,
'status'
)
->
checkbox
()
?>
<?php
echo
$form
->
field
(
$model
,
'widget_template_id'
)
->
dropDownList
(
$model
::
optsWidgetTemplateId
(),
<div
class=
"row"
>
[
<div
class=
"col-sm-8"
>
'onchange'
=>
'widgets.updateTemplate()'
<?php
Box
::
begin
()
?>
]
<?php
echo
$form
->
field
(
$model
,
'widget_template_id'
)
->
dropDownList
(
$model
::
optsWidgetTemplateId
(),
)
?>
[
'onchange'
=>
'widgets.updateTemplate()'
<?php
\yii\widgets\Pjax
::
begin
([
'id'
=>
'pjax-widget-form'
])
?>
]
<?php
echo
$form
->
field
(
$model
,
'default_properties_json'
)
)
?>
->
widget
(
\beowulfenator\JsonEditor\JsonEditorWidget
::
className
(),
[
'schema'
=>
$schema
,
<?php
\yii\widgets\Pjax
::
begin
([
'id'
=>
'pjax-widget-form'
])
?>
'clientOptions'
=>
[
<?php
echo
$form
->
field
(
$model
,
'default_properties_json'
)
'theme'
=>
'bootstrap3'
,
->
widget
(
\beowulfenator\JsonEditor\JsonEditorWidget
::
className
(),
[
'disable_collapse'
=>
true
,
'schema'
=>
$schema
,
'disable_edit_json'
=>
true
,
'clientOptions'
=>
[
'disable_properties'
=>
true
,
'theme'
=>
'bootstrap3'
,
'no_additional_properties'
=>
true
,
'disable_collapse'
=>
true
,
],
'disable_edit_json'
=>
true
,
]);
?>
'disable_properties'
=>
true
,
<?php
\yii\widgets\Pjax
::
end
()
?>
'no_additional_properties'
=>
true
,
],
]);
?>
<?php
echo
$form
->
field
(
$model
,
'name_id'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
\yii\widgets\Pjax
::
end
()
?>
<?php
echo
$form
->
field
(
$model
,
'container_id'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'rank'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
Box
::
end
()
?>
<?php
echo
$form
->
field
(
$model
,
'route'
)
->
textInput
([
'maxlength'
=>
true
])
?>
</div>
<?php
echo
$form
->
field
(
$model
,
'request_param'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<div
class=
"col-sm-4"
>
<?php
echo
$form
->
field
(
$model
,
'access_owner'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
Box
::
begin
()
?>
<?php
echo
$form
->
field
(
$model
,
'access_domain'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'access_read'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'status'
)
->
checkbox
()
?>
<?php
echo
$form
->
field
(
$model
,
'access_update'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'name_id'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'access_delete'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'route'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'request_param'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'container_id'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'rank'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
Box
::
end
()
?>
<?php
Box
::
begin
([
'title'
=>
'Access'
,
'collapse'
=>
true
,
'collapseDefault'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'access_domain'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'access_owner'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'access_read'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'access_update'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
echo
$form
->
field
(
$model
,
'access_delete'
)
->
textInput
([
'maxlength'
=>
true
])
?>
<?php
Box
::
end
()
?>
</div>
</div>
</p>
</p>
<?php
$this
->
endBlock
();
?>
<?php
$this
->
endBlock
();
?>
...
...
src/views/default/_create-widget.php
deleted
100644 → 0
View file @
e8bd7202
<?php
namespace
_
;
use
yii\helpers\Html
;
?>
<div
class=
"col-sm-3"
>
<?=
Html
::
a
(
$model
->
name
,
[
'/widgets/crud/widget/create'
,
'widget_template_id'
=>
$model
->
id
],
[
'class'
=>
'btn btn-default btn-block'
])
?>
</div>
src/views/default/index.php
View file @
85cd720e
...
@@ -12,8 +12,6 @@ use yii\widgets\ListView;
...
@@ -12,8 +12,6 @@ use yii\widgets\ListView;
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"col-sm-6"
>
<?=
\insolita\wgadminlte\SmallBox
::
widget
(
<?=
\insolita\wgadminlte\SmallBox
::
widget
(
[
[
'head'
=>
'Co'
,
'head'
=>
'Co'
,
...
@@ -21,11 +19,8 @@ use yii\widgets\ListView;
...
@@ -21,11 +19,8 @@ use yii\widgets\ListView;
'footer_link'
=>
[
'crud/widget'
]
'footer_link'
=>
[
'crud/widget'
]
]
]
)
?>
)
?>
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"col-sm-6"
>
<?=
\insolita\wgadminlte\SmallBox
::
widget
(
<?=
\insolita\wgadminlte\SmallBox
::
widget
(
[
[
'head'
=>
'Wi'
,
'head'
=>
'Wi'
,
...
@@ -35,13 +30,3 @@ use yii\widgets\ListView;
...
@@ -35,13 +30,3 @@ use yii\widgets\ListView;
)
?>
)
?>
</div>
</div>
</div>
</div>
<?php
Box
::
begin
([
'title'
=>
'Create new widgets'
])
?>
<div
class=
"row"
>
<?=
ListView
::
widget
([
'dataProvider'
=>
$templatesDataProvider
,
'itemView'
=>
'_create-widget'
])
?>
</div>
<?php
Box
::
end
()
?>
src/widgets/WidgetContainer.php
View file @
85cd720e
...
@@ -67,7 +67,7 @@ class WidgetContainer extends Widget
...
@@ -67,7 +67,7 @@ class WidgetContainer extends Widget
return
[
return
[
[
[
'label'
=>
'Create '
.
$this
->
id
.
'
widget
'
,
'label'
=>
'Create '
.
$this
->
id
.
'
<span class="label label-info">widget</span>
'
,
'url'
=>
[
'url'
=>
[
'/widgets/crud/widget/create'
,
'/widgets/crud/widget/create'
,
'WidgetContent'
=>
[
'WidgetContent'
=>
[
...
@@ -79,7 +79,7 @@ class WidgetContainer extends Widget
...
@@ -79,7 +79,7 @@ class WidgetContainer extends Widget
]
]
],
],
[
[
'label'
=>
'
Show '
.
$this
->
id
.
' widgets
'
,
'label'
=>
'
Edit '
.
$this
->
id
.
' <span class="label label-info">widget</span>
'
,
'url'
=>
[
'url'
=>
[
'/widgets/crud/widget/index'
,
'/widgets/crud/widget/index'
,
'WidgetContent'
=>
[
'WidgetContent'
=>
[
...
...
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