$this->params['breadcrumbs'][] = ['label' => 'Comments Management', 'url' => ['index']]; $this->params['breadcrumbs'][] = 'Update'; ?> <div class="comment-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <div class="comment-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'content')->widget(Widget::className(), ['options' => ['minHeight' => 300, 'replaceDivs' => true, 'paragraphize' => false], 'id' => 'content']); ?> <?php echo $form->field($model, 'status')->dropDownList(CommentStatus::listData()); ?> <div class="form-group"> <?php echo Html::submitButton('Update', ['class' => 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div> </div>
/* @var $commentModel \yii2mod\comments\models\CommentModel */ $this->title = Yii::t('yii2mod.comments', 'Comments Management'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="comments-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php Pjax::begin(['enablePushState' => false, 'timeout' => 5000]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'contentOptions' => ['style' => 'max-width: 50px;']], ['attribute' => 'content', 'contentOptions' => ['style' => 'max-width: 350px;'], 'value' => function ($model) { return StringHelper::truncate($model->content, 100); }], 'attribute' => 'relatedTo', ['attribute' => 'createdBy', 'value' => function ($model) { return $model->getAuthorName(); }, 'filter' => $commentModel::getListAuthorsNames(), 'filterInputOptions' => ['prompt' => Yii::t('yii2mod.comments', 'Select Author'), 'class' => 'form-control']], ['class' => EditableColumn::className(), 'attribute' => 'status', 'url' => ['edit-comment'], 'value' => function ($model) { return CommentStatus::getLabel($model->status); }, 'type' => 'select', 'editableOptions' => function ($model) { return ['source' => Json::encode(CommentStatus::listData()), 'value' => $model->status]; }, 'filter' => CommentStatus::listData(), 'filterInputOptions' => ['prompt' => Yii::t('yii2mod.comments', 'Select Status'), 'class' => 'form-control']], ['attribute' => 'createdAt', 'value' => function ($model) { return Yii::$app->formatter->asDatetime($model->createdAt); }, 'filter' => false], ['header' => 'Actions', 'class' => 'yii\\grid\\ActionColumn', 'template' => '{update}{delete}']]]); ?> <?php Pjax::end(); ?> </div>