Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contact force verification #2

Closed
wants to merge 4 commits into from

Conversation

bladeroot
Copy link
Member

  • ForceVerificationBlock widget
  • use ForceVerificationBlock in Contact and Client View

<?php $box->end() ?>
<?php endif ?>
<?= ForceVerificationBlock::widget([
'model' => $model,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

у тебя тут отступ 8 пробелов - а у нас везде 4
проверь свои настройки что было 4

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

правильно. виджет находится между дивами. таб = 4 пробела

@@ -48,6 +50,10 @@
<?= ClientDetailMenu::widget(['model' => $model]) ?>
</div>
<?php Box::end() ?>

<?= ForceVerificationBlock::widget([
'model' => $model->contact
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

закидывай запятую в массивах, потом легче докидывать новые элементы

Copy link
Member

@hiqsol hiqsol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По-моему всё зашибись!
Ещё Дима глянет и замержит.

<?= Verification::widget([
'model' => $model->getVerification($attribute),
'scenario' => $scenario,
'submitUrl' => $submitUrl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут тоже не хватает запятой

use yii\helpers\Html;
use hipanel\widgets\Box;
use hipanel\modules\client\widgets\Verification;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В блоке PHPDoc мы описываем переменные, которые приходят извне.
Смотри пример тут https://github.com/hiqdev/hipanel-module-mailing/blob/master/src/views/prepare/index.php#L6-L14


if ($this->title === null) {
$this->title = Yii::t('hipanel:client', 'Verification level');

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишняя строка

*
* @var array
*/
public $options = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

кажется, это свойство не используется

'scenario' => $this->scenario,
'submitUrl' => $this->submitUrl
]);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Методы должны иметь явно описанные возвращаемые данные. Предпочтительно использование условий для прерывания выполнения, вместо описания полезного кода внутри if. Это упрощает чтение кода.

        if (!Yii::$app->user->can('contact.force-verify')) {
             return;
        }
        
        return $this->render((new \ReflectionClass($this))->getShortName(), [
                 'attributes' => $this->attributes,
                 'model' => $this->model,
                 'title' => $this->title,
                 'scenario' => $this->scenario,
                 'submitUrl' => $this->submitUrl
             ]);
        }

@bladeroot bladeroot closed this Jan 8, 2017
@bladeroot bladeroot deleted the contact-force-verification branch January 8, 2017 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants