Commit eba4f238 by Junaid Rahman pv

added file editor

parent 0a811f75
...@@ -45,7 +45,8 @@ class ThemeFileController extends \yii\web\Controller ...@@ -45,7 +45,8 @@ class ThemeFileController extends \yii\web\Controller
{ {
$model = $this->findModel($id); $model = $this->findModel($id);
if ($model->load(Yii::$app->request->post())) { if ($model->load(Yii::$app->request->post())) {
$file = yii::getAlias('@storage/private/theme-assets/') .$model->theme_code . '/' .$model->file_code;
file_put_contents($file, $model->fileContent);
} }
return $this->render('editor',[ return $this->render('editor',[
'model' => $model, 'model' => $model,
......
...@@ -7,16 +7,29 @@ ...@@ -7,16 +7,29 @@
*/ */
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use yii\helpers\Html; use yii\helpers\Html;
?> ?>
<div class="text-block-form"> <div class="text-block-form">
<?php $form = ActiveForm::begin(); ?> <?php $form = ActiveForm::begin(); ?>
<?php <?php
$file = yii::getAlias('@storage/private/theme-assets/') .$model->theme_code . '/' .$model->file_code; $file = yii::getAlias('@storage/private/theme-assets/') . $model->theme_code . '/' . $model->file_code;
$model->fileContent = file_get_contents($file); $model->fileContent = file_get_contents($file);
?> ?>
?>
<div class="page-header">
<h4> <b>Theme code: </b>
<?=$model->theme_code?>
<br><br><b>File code:</b>
<?=$model->file_code?>
</h4>
</div>
<?= $form->field($model, 'fileContent')->widget( <?= $form->field($model, 'fileContent')->widget(
trntv\aceeditor\AceEditor::className(), trntv\aceeditor\AceEditor::className(),
......
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