Исправление представлений

This commit is contained in:
RedHood 2021-01-31 17:23:17 +10:00
parent 706c9b0743
commit 6a7f8897d5
5 changed files with 22 additions and 9 deletions

View File

@ -2,11 +2,15 @@
namespace app\controllers; namespace app\controllers;
use app\models\AccountForm;
use Yii; use Yii;
use yii\web\Controller; use yii\web\Controller;
use yii\web\Response; use yii\web\Response;
use yii\filters\AccessControl; use yii\filters\AccessControl;
use app\models\AccountForm;
use Throwable;
use Exception;
class AuthenticationController extends Controller class AuthenticationController extends Controller
{ {
@ -54,7 +58,19 @@ class AuthenticationController extends Controller
// Запись ответа // Запись ответа
$return['redirect'] = '/' . $cookies['redirect']; $return['redirect'] = '/' . $cookies['redirect'];
try {
if (empty($return['main'] = $this->renderPartial($return['redirect']))) {
throw new Exception('Представление найдено, но вернуло пустой результат');
}
} catch (Throwable $t) {
$return['main'] = $this->renderPartial($return['redirect'] . '/index'); $return['main'] = $this->renderPartial($return['redirect'] . '/index');
}
// Генерация и запись
// $controller = 'app\\controllers\\' . ucfirst($cookies['redirect']) . 'Controller';
// $action = 'action' . ucfirst($cookies['redirect_action']);
// $return['main'] = (new $controller())->$action();
// Очистка cookie // Очистка cookie
unset(Yii::$app->response->cookies['redirect']); unset(Yii::$app->response->cookies['redirect']);

View File

@ -6,15 +6,12 @@ namespace app\models;
use Yii; use Yii;
use app\models\Account;
use app\models\Product; use app\models\Product;
use app\models\SupplyEdgeProduct; use app\models\SupplyEdgeProduct;
use app\models\traits\Xml2Array; use app\models\traits\Xml2Array;
use carono\exchange1c\interfaces\ProductInterface; use carono\exchange1c\interfaces\ProductInterface;
use mirzaev\yii2\arangodb\Query;
/** /**
* Поставка (выгрузка товаров от поставщиков) * Поставка (выгрузка товаров от поставщиков)
* *

View File

@ -28,7 +28,7 @@ use app\models\AccountForm;
$model = $model ?? new AccountForm; $model = $model ?? new AccountForm;
?> ?>
<?= $form->field($model, 'mail', ['enableLabel' => false])->textInput(['autofocus' => true, 'placeholder' => $model->getAttributeLabel('mail')]) ?> <?= $form->field($model, 'mail', ['enableLabel' => false, 'options' => ['class' => 'mb-2']])->textInput(['autofocus' => true, 'placeholder' => $model->getAttributeLabel('mail')]) ?>
<?= $form->field($model, 'pswd', ['enableLabel' => false])->passwordInput(['placeholder' => $model->getAttributeLabel('pswd')]) ?> <?= $form->field($model, 'pswd', ['enableLabel' => false])->passwordInput(['placeholder' => $model->getAttributeLabel('pswd')]) ?>
<div class="d-flex mb-2 mt-3"> <div class="d-flex mb-2 mt-3">

View File

@ -1,16 +1,16 @@
<?php <?php
use yii\bootstrap\ActiveForm; use yii\bootstrap\ActiveForm;
use app\controllers\ProfileController;
use app\models\Supply; use app\models\Supply;
?> ?>
<link href="/css/pages/profile.css" rel="stylesheet"> <link href="/css/pages/profile.css" rel="stylesheet">
<div id="page_profile" class="container h-100"> <div id="page_profile" class="container h-100">
<div class="row h-100 py-3"> <div class="row h-100 py-3">
<nav class="col-3"> <nav class="col-3">
<?= $sidebar ?> <?= $sidebar ?? Yii::$app->controller->renderPartial('/profile/sidebar') ?>
</nav> </nav>
<article class="col-9"> <article class="col-9">
<div class="h-100 p-4 rounded"> <div class="h-100 p-4 rounded">

View File

@ -13,7 +13,7 @@ use app\models\Supply;
<div id="page_profile" class="container h-100"> <div id="page_profile" class="container h-100">
<div class="row h-100 py-3"> <div class="row h-100 py-3">
<nav class="col-3"> <nav class="col-3">
<?= $sidebar ?> <?= $sidebar ?? Yii::$app->controller->renderPartial('/profile/sidebar') ?>
</nav> </nav>
<article class="col-9"> <article class="col-9">
<div class="h-100 p-4 rounded"> <div class="h-100 p-4 rounded">