Commit 85cd720e authored by Tobias Munk's avatar Tobias Munk

updated widget form

parent e8bd7202
...@@ -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 Name'), 'widget_template_id' => Yii::t('app', 'Template'),
'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'),
]); ]);
} }*/
} }
...@@ -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(); ?>
......
<?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>
...@@ -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() ?>
...@@ -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' => [
......
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