Commit 982c3376093cff244d3956d5da99d996d14b9237
1 parent
d7245f5e
- logo
Showing
4 changed files
with
12 additions
and
13 deletions
Show diff stats
backend/controllers/SettingsController.php
@@ -53,7 +53,7 @@ | @@ -53,7 +53,7 @@ | ||
53 | $mail = Mail::findOne(1); | 53 | $mail = Mail::findOne(1); |
54 | if ($model->load(Yii::$app->request->post()) && Model::loadMultiple($model->getVariationModels(), \Yii::$app->request->post())) { | 54 | if ($model->load(Yii::$app->request->post()) && Model::loadMultiple($model->getVariationModels(), \Yii::$app->request->post())) { |
55 | foreach ($model->getVariationModels() as $index => $lang){ | 55 | foreach ($model->getVariationModels() as $index => $lang){ |
56 | - $lang->id = $index+1; | 56 | + $lang->id = $lang->language_id; |
57 | } | 57 | } |
58 | if ($model->save()){ | 58 | if ($model->save()){ |
59 | if (!empty($_FILES['logo']['tmp_name'])){ | 59 | if (!empty($_FILES['logo']['tmp_name'])){ |
@@ -69,7 +69,6 @@ | @@ -69,7 +69,6 @@ | ||
69 | $mail->save(); | 69 | $mail->save(); |
70 | return $this->goHome(); | 70 | return $this->goHome(); |
71 | } | 71 | } |
72 | - | ||
73 | return $this->render( | 72 | return $this->render( |
74 | 'settings', | 73 | 'settings', |
75 | [ | 74 | [ |
backend/views/settings/_main_tab.php
@@ -11,6 +11,14 @@ | @@ -11,6 +11,14 @@ | ||
11 | * @var ActiveForm $form | 11 | * @var ActiveForm $form |
12 | * @var string $logo | 12 | * @var string $logo |
13 | */ | 13 | */ |
14 | + if (!empty($model->logo)) { | ||
15 | + $logo[] = '<img src="/storage/logo/' . $model->logo . '" class="file-preview-image kv-preview-data rotate-35921 is-portrait-gt4" style="width:200px;" title="' . $model->logo . '">'; | ||
16 | + $config = ["url" => "delete-image", "key" => 0, 'extra' => ['image' => $model->logo]]; | ||
17 | + | ||
18 | + } else { | ||
19 | + $logo = []; | ||
20 | + $config = []; | ||
21 | + } | ||
14 | echo '<div class="wrapp-blocks-edit-page">'; | 22 | echo '<div class="wrapp-blocks-edit-page">'; |
15 | echo $form->field($model, 'name') | 23 | echo $form->field($model, 'name') |
16 | ->textInput(); | 24 | ->textInput(); |
@@ -48,7 +56,7 @@ | @@ -48,7 +56,7 @@ | ||
48 | 56 | ||
49 | 57 | ||
50 | echo $form->field($variationModel, '[' . $index . ']' . 'id') | 58 | echo $form->field($variationModel, '[' . $index . ']' . 'id') |
51 | - ->hiddenInput(['value' => $index])->label(false); | 59 | + ->hiddenInput(['value' => $variationModel->language_id])->label(false); |
52 | echo '</div>'; | 60 | echo '</div>'; |
53 | echo '<div class="tabs-lang" '.($index > 0 ? 'style="display:none"' : '').'>'; | 61 | echo '<div class="tabs-lang" '.($index > 0 ? 'style="display:none"' : '').'>'; |
54 | echo $form->field($variationModel, '[' . $index . ']' . 'about') | 62 | echo $form->field($variationModel, '[' . $index . ']' . 'about') |
backend/views/settings/settings.php
@@ -19,7 +19,7 @@ $languages = \artbox\core\models\Language::getActive(); | @@ -19,7 +19,7 @@ $languages = \artbox\core\models\Language::getActive(); | ||
19 | 19 | ||
20 | 20 | ||
21 | <?php | 21 | <?php |
22 | - $form = ActiveForm::begin(); | 22 | + $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); |
23 | ?> | 23 | ?> |
24 | <div class="x_panel panel_settings"> | 24 | <div class="x_panel panel_settings"> |
25 | <div class="x_content"> | 25 | <div class="x_content"> |
common/models/Settings.php
@@ -122,15 +122,7 @@ | @@ -122,15 +122,7 @@ | ||
122 | [ | 122 | [ |
123 | 'logo', | 123 | 'logo', |
124 | ], | 124 | ], |
125 | - 'integer', | ||
126 | - ], | ||
127 | - [ | ||
128 | - [ | ||
129 | - 'logo', | ||
130 | - ], | ||
131 | - 'exist', | ||
132 | - 'targetClass' => ImageManager::className(), | ||
133 | - 'targetAttribute' => 'id', | 125 | + 'string', |
134 | ], | 126 | ], |
135 | [ | 127 | [ |
136 | [ | 128 | [ |