Commit cf846133 by Junaid Rahman pv

bug fix

parent 552d6af1
...@@ -86,7 +86,7 @@ class ThemeFileController extends \yii\web\Controller ...@@ -86,7 +86,7 @@ class ThemeFileController extends \yii\web\Controller
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 = yii::getAlias('@storage/private/theme-assets/') . $model->theme_code . '/' . $model->file_code;
file_put_contents($file, $model->fileContent); file_put_contents($file, $model->fileContent);
Yii::$app->getSession()->setFlash('success', [ Yii::$app->getSession()->setFlash('fileContentUpdated', [
'type' => 'success', 'type' => 'success',
'duration' => 5000, 'duration' => 5000,
'icon' => 'fa fa-file', 'icon' => 'fa fa-file',
......
...@@ -10,7 +10,6 @@ use yii\widgets\ActiveForm; ...@@ -10,7 +10,6 @@ use yii\widgets\ActiveForm;
?> ?>
<div class="customer-form"> <div class="customer-form">
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<table class="table"> <table class="table">
...@@ -37,12 +36,14 @@ use yii\widgets\ActiveForm; ...@@ -37,12 +36,14 @@ use yii\widgets\ActiveForm;
?> ?>
<td> <td>
<div class="form-group">
<?php $form = ActiveForm::begin(['action' => '../theme-file/delete?id=' . $fileModel->id]); ?> <?php $form = ActiveForm::begin(['action' => '../theme-file/delete?id=' . $fileModel->id]); ?>
<?= $form->field($fileModel, <?= $form->field($fileModel,
'theme_id')->hiddenInput(['value' => $model->id])->label(false) ?> 'theme_id')->hiddenInput(['value' => $model->id])->label(false) ?>
<?= Html::a(' Edit ', ['theme-file/editor', 'id' => $fileModel->id], [
'class' => 'btn btn-primary fa fa-edit', <?= Html::a(' Edit ', ['theme-file/editor', 'id' => $fileModel->id],
]) ?> ['class' => 'btn btn-primary fa fa-edit',]) ?>
<?= Html::submitButton(Yii::t('backend', ' Delete'), <?= Html::submitButton(Yii::t('backend', ' Delete'),
[ [
...@@ -51,6 +52,17 @@ use yii\widgets\ActiveForm; ...@@ -51,6 +52,17 @@ use yii\widgets\ActiveForm;
]) ?> ]) ?>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
<?php $form = ActiveForm::begin(['action' => '../theme-file/delete?id=' . $fileModel->id]); ?>
<?= $form->field($fileModel,
'theme_id')->hiddenInput(['value' => $model->id])->label(false) ?>
<?= Html::submitButton(Yii::t('backend', ' Delete'),
[
'class' => 'btn btn-primary fa fa-trash',
'onclick' => 'return confirm("Are you sure?")'
]) ?>
<?php ActiveForm::end(); ?>
</div>
</td> </td>
<?php } else { ?> <?php } else { ?>
......
...@@ -7,41 +7,66 @@ ...@@ -7,41 +7,66 @@
*/ */
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
$this->title = Yii::t('backend', 'Editor');
$this->params['breadcrumbs'][] = ['label' => 'Themes', 'url' => ['theme/index']];
$this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="text-block-form"> <div class="text-block-form" style="background-color: #222D32;color: orange">.
<div class="container">
<?php $form = ActiveForm::begin(); ?>
<?php $form = ActiveForm::begin(); ?> <div class="form-group">
<?php <div class="row">
$file = yii::getAlias('@storage/private/theme-assets/') . $model->theme_code . '/' . $model->file_code; <div class="col-md-11">
$model->fileContent = file_get_contents($file);
?> <!-- <?//= Breadcrumbs::widget([
// 'homeLink' => [
// 'label' => Yii::t('yii', 'Dashboard'),
// 'url' => Yii::$app->homeUrl,
// ],
// 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
// ]) ?> -->
<?= Html::submitButton(Yii::t('backend', 'Update'),
[
'class' => 'btn btn-success'
]
) ?>
</div>
</div>
</div>
<?php
$file = yii::getAlias('@storage/private/theme-assets/') . $model->theme_code . '/' . $model->file_code;
$model->fileContent = file_get_contents($file);
?>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<b>File: </b><?= $model->theme_code ?>/<?= $model->file_code ?><br/><br/> <b>File: </b><span style="color: #00acd6"><?= $model->theme_code ?>/<?= $model->file_code ?></span><br/><br/>
</div> </div>
</div> </div>
<?= $form->field($model, 'fileContent')->widget( <div class="row">
<div class="col-md-11">
<?= $form->field($model, 'fileContent')->widget(
trntv\aceeditor\AceEditor::className(), trntv\aceeditor\AceEditor::className(),
[ [
'mode' => 'html', 'mode' => 'html',
'theme' => 'chaos', 'theme' => 'chaos',
] ]
) ?>
<div class="form-group">
<?= Html::submitButton(
$model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'),
[
'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']
) ?> ) ?>
</div>
</div>
</div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div>
</div> </div>
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