public function aliasInput($related, $options = []) { $related_id = '#' . Html::getInputId($this->model, $related); $alias_id = '#' . $this->getInputId(); $view = $this->form->getView(); $url = \yii\helpers\Url::toRoute(['alias-create']); $script = "\$('body').on('change','{$related_id}',function(){ \$.post('{$url}',{name:\$('{$related_id}').val()},function(data){ if (\$('{$alias_id}').val()) { UIkit.modal.confirm('Replace alias? '+data.alias, function(){ \$('{$alias_id}').val(data.alias) }); } else \$('{$alias_id}').val(data.alias)} )});"; $view->registerJs($script, $view::POS_READY); \worstinme\uikit\assets\Notify::register($view); $options = array_merge($this->inputOptions, $options, ['class' => 'uk-form-small uk-form-width-large']); $this->adjustLabelFor($options); $this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $options); return $this; }
<?php use yii\helpers\Html; use yii\helpers\Url; use worstinme\uikit\ActiveForm; use yii\captcha\Captcha; \worstinme\uikit\assets\Notify::register($this); ?> <section id="comments"> <ul class="uk-comment-list"><?php if (count($comments)) { ?> <?php foreach ($comments as $comment) { ?> <?php echo $this->render('_comment', ['comment' => $comment, 'url' => $url]); ?> <?php } ?> <?php } ?> </ul> <hr> <?php if ($respond) { ?>