| Current Path : /var/www/html/kpwkm/backend/modules/api/views/api/ |
| Current File : /var/www/html/kpwkm/backend/modules/api/views/api/_form.php |
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\assets\AceEditorAsset;
/* @var $this yii\web\View */
/* @var $model backend\modules\api\models\Api */
/* @var $form yii\widgets\ActiveForm */
AceEditorAsset::register($this);
$this->registerJs(
<<<JS
var textarea = $('#api-api_content').hide();
var editor = ace.edit('editorContent');
editor.setOptions({
maxLines: Infinity,
});
editor.setTheme("ace/theme/monokai");
//editor.\$blockScrolling = Infinity;
editor.getSession().setMode("ace/mode/php");
editor.getSession().setValue(textarea.val());
editor.getSession().on('change', function () {
textarea.val(editor.getSession().getValue());
});
JS
);
?>
<style type="text/css" media="screen">
.ace_editor{ min-height:300px;z-index:9999;}
.ace_text-input{position:absolute!important}
#editorContent{margin-bottom:2em;}
.field-api-api_content{margin:0 !important;}
.field-api-api_content .help-block{margin:0 !important;}
</style>
<?php $form = ActiveForm::begin(); ?>
<div class="wrapper wrapper-content animated fadeInRight" style="padding: 20px 10px 20px;">
<div class="ibox float-e-margins">
<div class="ibox-content">
<?= $form->field($model, 'api_code')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'api_descr')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'api_content')->textarea(['rows' => 6]) ?>
<div id="editorContent"></div>
<div class="form-group">
<?= Html::a(Yii::t('app', 'Back'), ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-primary']) ?>
</div>
</div>
</div>
</div>
<?php ActiveForm::end(); ?>