use app\helpers\Icon; use app\widgets\ActiveForm; use app\widgets\InputGroup; use yii\bootstrap\Button; use yii\helpers\Html; use yii\web\JsExpression; /** @var $this yii\web\View */ /** @var $form app\widgets\ActiveForm */ /** @var $model app\forms\user\Profile */ /** @var $emailId string */ $emailId = Html::getInputId($model, 'email'); $form = ActiveForm::begin(['id' => 'user-profile-form', 'pjax' => true, 'layout' => 'horizontal', 'enableClientValidation' => true, 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10']]]); ?> <?php echo $form->field($model, 'email')->widget(InputGroup::className(), ['inputOptions' => ['class' => 'form-control', 'disabled' => 'disabled'], 'button' => true, 'addon' => Button::widget(['label' => Icon::icon('glyphicon glyphicon-copy'), 'encodeLabel' => false, 'options' => ['class' => 'btn btn-default btn-flat'], 'clientEvents' => ['click' => new JsExpression("function (ev) {\n ev.preventDefault();\n \$('#{$emailId}').removeAttr('disabled').select();\n document.execCommand('copy');\n \$('#{$emailId}').attr('disabled', 'disabled');\n }")]])]); ?> <?php echo $form->field($model, 'name'); ?> <?php echo $form->field($model, 'password')->passwordInput(); ?> <?php echo $form->field($model, 'password_repeat')->passwordInput(); ?> <?php ActiveForm::endWithActions(['cancel' => false]); ?>
?> <?php echo Html::a(Yii::t('app', 'Create'), ['page/create'], ['class' => 'btn btn-flat btn-default']); ?> <?php } ?> </div> <?php if (!$rootPages) { ?> <?php echo Yii::t('app', 'Page list is empty.'); } ?> <ul class="list-unstyled pages"> <?php foreach ($rootPages as $wiki) { ?> <li class="wiki-page"> <?php echo Html::a(Icon::icon($wiki->getChildren()->count() ? 'fa fa-book' : 'fa fa-file-text') . e($wiki->title), ['page/view', 'id' => $wiki->id]); ?> </li> <?php } ?> </ul> <?php Box::end();
protected function renderTime($model) { if ($this->timeView instanceof Closure) { $time = call_user_func($this->timeView, $model); } elseif (is_string($this->timeView)) { $time = $this->timeView; } else { return ''; } $time = Icon::icon('fa fa-clock-o') . ' ' . $time; return Html::tag('span', $time, ['class' => 'time']); }
/** * @inheritdoc */ public function run() { $this->addon = Button::widget(['label' => Icon::icon($this->icon), 'options' => $this->buttonOptions, 'encodeLabel' => false, 'clientEvents' => ['click' => new JsExpression("\n function (ev) {\n ev.preventDefault();\n jQuery('#{$this->inputOptions['id']}').val('');\n }\n ")]]); return parent::run(); }
<div class="wiki-summary"> <span class="summary-info text-muted text-sm"> <?php echo Yii::t('app', 'Added by {creator}, last edit by {editor} {time}', ['creator' => Yii::$app->formatter->asUserlink($wiki->user), 'editor' => Yii::$app->formatter->asUserlink($wiki->historyLatest->user), 'time' => Yii::$app->formatter->asRelativeTime($wiki->historyLatest->created_at)]); ?> </span> </div> <?php echo Yii::$app->formatter->asMarkdown($wiki->historyLatest->content); Box::end(); ?> <?php if ($wiki->getChildren()->count()) { Box::begin(['label' => Yii::t('app', 'Child pages')]); ?> <ul class="list-unstyled"> <?php foreach ($wiki->children as $child) { ?> <li><?php echo Html::a(Icon::icon('fa fa-file-text', e($child->title)), ['page/view', 'id' => $child->id]); ?> </li> <?php } ?> </ul> <?php Box::end(); }
/** * Render loading spinner and fetch content. */ protected function renderLoading() { if ($this->loading) { echo Html::tag('div', Icon::icon('fa fa-refresh fa-spin'), ['class' => 'overlay']); } if (is_array($this->loading)) { $id = $this->getId(); $url = Url::to($this->loading); $error = addcslashes($this->loadingError, "'"); $js = "jQuery('#{$id} .box-body').load('{$url}', function (response, status) {\n if (status === 'error') { \$(this).html('{$error}'); }\n jQuery('#{$id} .overlay').remove();\n });"; $this->getView()->registerJs($js); } }