Commit 77422ce3b225804d79d6b8e2d3ba6ae57b59f58d
1 parent
75ca5709
edit upload form
Showing
3 changed files
with
17 additions
and
9 deletions
Show diff stats
backend/controllers/ParserController.php
@@ -5,7 +5,7 @@ use Yii; | @@ -5,7 +5,7 @@ use Yii; | ||
5 | use yii\filters\AccessControl; | 5 | use yii\filters\AccessControl; |
6 | use yii\web\Controller; | 6 | use yii\web\Controller; |
7 | use yii\filters\VerbFilter; | 7 | use yii\filters\VerbFilter; |
8 | -use app\models\UploadForm; | 8 | +use app\models\UploadFileParsingForm; |
9 | use yii\web\UploadedFile; | 9 | use yii\web\UploadedFile; |
10 | use yii\data\ArrayDataProvider; | 10 | use yii\data\ArrayDataProvider; |
11 | use app\components\parsers\ParserHandler; | 11 | use app\components\parsers\ParserHandler; |
@@ -54,7 +54,7 @@ class ParserController extends Controller | @@ -54,7 +54,7 @@ class ParserController extends Controller | ||
54 | 54 | ||
55 | public function actionIndex() | 55 | public function actionIndex() |
56 | { | 56 | { |
57 | - $model = new UploadForm(); | 57 | + $model = new UploadFileParsingForm(); |
58 | 58 | ||
59 | if (Yii::$app->request->isPost) { | 59 | if (Yii::$app->request->isPost) { |
60 | $model->file = UploadedFile::getInstance($model, 'file'); | 60 | $model->file = UploadedFile::getInstance($model, 'file'); |
backend/models/UploadForm.php renamed to backend/models/UploadFileParsingForm.php
@@ -7,7 +7,7 @@ use yii\web\UploadedFile; | @@ -7,7 +7,7 @@ use yii\web\UploadedFile; | ||
7 | /** | 7 | /** |
8 | * UploadForm is the model behind the upload form. | 8 | * UploadForm is the model behind the upload form. |
9 | */ | 9 | */ |
10 | -class UploadForm extends Model | 10 | +class UploadFileParsingForm extends Model |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | * @var UploadedFile file attribute | 13 | * @var UploadedFile file attribute |
backend/views/parser/index.php
1 | <?php | 1 | <?php |
2 | use yii\widgets\ActiveForm; | 2 | use yii\widgets\ActiveForm; |
3 | +use yii\helpers\Html; | ||
4 | + | ||
3 | ?> | 5 | ?> |
4 | - <div class="catalog-view"> | ||
5 | -<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?> | 6 | +<div class="row"> |
7 | + <div class="col-lg-5"> | ||
8 | + <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?> | ||
9 | + <?= $form->field($model, 'first_line') ?> | ||
10 | + <?= $form->field($model, 'first_column') ?> | ||
6 | 11 | ||
7 | -<?= $form->field($model, 'file')->fileInput() ?> | 12 | + <?= $form->field($model, 'file')->fileInput() ?> |
8 | 13 | ||
9 | -<button>Прочитать</button> | 14 | + <div class="form-group"> |
15 | + <?= Html::submitButton(Yii::t('app', 'Submit'), ['class' => 'btn btn-primary']) ?> | ||
16 | + </div> | ||
10 | 17 | ||
11 | -<?php ActiveForm::end() ?> | ||
12 | - </div> | ||
13 | \ No newline at end of file | 18 | \ No newline at end of file |
19 | + <?php ActiveForm::end() ?> | ||
20 | + </div> | ||
21 | +</div> | ||
14 | \ No newline at end of file | 22 | \ No newline at end of file |