1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- use yii\helpers\Html;
- use yii\widgets\ActiveForm;
- /* @var $this yii\web\View */
- /* @var $model common\models\Page */
- /* @var $form yii\widgets\ActiveForm */
- ?>
- <div class="box box-success">
- <div class="box-body">
- <?php $form = ActiveForm::begin(['enableClientValidation'=>false]); ?>
- <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
- <?= $form->field($model, 'type',['options'=>['class'=>'hide']])->textInput(['maxlength' => true]) ?>
- <?php
-
- foreach ($configModels as $index => $configModel) {
- $value = explode("\r\n",$configModel['extra']);
- $arr = [];
- foreach($value as &$val){
- $val = trim($val);
- $arr[$val] = $val;
- }
- echo $form->field($model, 'id')->checkboxList($arr,[
- 'name'=>$configModel['name'],
- 'value'=>$model->filter[$configModel['name']]
- ])->label($configModel['description']);
- }
-
- ?>
- <?= $form->field($model, 'content')->widget(\common\widgets\EditorWidget::className(), $model->isNewRecord ? ['type' => request('editor') ?: config('page_editor_type')] : ['isMarkdown' => $model->markdown]) ?>
- <div class="form-group form-submit">
- <?= Html::submitButton($model->isNewRecord ? '创建' : '更新', ['class' => 'btn btn-flat bg-maroon btn-block']) ?>
- </div>
- <?php ActiveForm::end(); ?>
- </div>
- </div>
- <?php $this->beginBlock('js') ?>
- <script>
- $(document).on('change', '#choose-editor', function () {
- var url = '<?= \yii\helpers\Url::to(['create']) ?>';
- var type = $(this).val();
- url = url.addQueryParams({editor: type});
- location.href = url;
- })
- </script>
- <?php $this->endBlock() ?>
|