コード例 #1
0
ファイル: index.php プロジェクト: yeesoft/yii2-yee-post
            <div class="row">
                <div class="col-sm-12 text-right">
                    <?php 
echo GridPageSize::widget(['pjaxId' => 'post-category-grid-pjax']);
?>
                </div>
            </div>

            <?php 
Pjax::begin(['id' => 'post-category-grid-pjax']);
?>

            <?php 
echo GridView::widget(['id' => 'post-category-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'bulkActionOptions' => ['gridId' => 'post-category-grid', 'actions' => [Url::to(['bulk-delete']) => Yii::t('yee', 'Delete')]], 'columns' => [['class' => 'yeesoft\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['class' => 'yeesoft\\grid\\columns\\TitleActionColumn', 'controller' => '/post/category', 'title' => function (Category $model) {
    return Html::a($model->title, ['/post/category/update', 'id' => $model->id], ['data-pjax' => 0]);
}, 'buttonsTemplate' => '{update} {delete}'], ['attribute' => 'parent_id', 'value' => function (Category $model) {
    if ($parent = $model->getParent()->one() and $parent->id > 1) {
        return Html::a($parent->title, ['/post/category/update', 'id' => $parent->id], ['data-pjax' => 0]);
    } else {
        return '<span class="not-set">' . Yii::t('yii', '(not set)') . '</span>';
    }
}, 'format' => 'raw', 'filter' => Category::getCategories(), 'filterInputOptions' => ['class' => 'form-control', 'encodeSpaces' => true]], 'description:ntext', ['class' => 'yeesoft\\grid\\columns\\StatusColumn', 'attribute' => 'visible']]]);
?>

            <?php 
Pjax::end();
?>
        </div>
    </div>
</div>
コード例 #2
0
ファイル: _form.php プロジェクト: yeesoft/yii2-yee-post
                    <?php 
if ($model->isMultilingual()) {
    ?>
                        <?php 
    echo LanguagePills::widget();
    ?>
                    <?php 
}
?>

                    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>

                    <?php 
echo $form->field($model, 'parent_id')->dropDownList(Category::getCategories(), ['prompt' => '', 'encodeSpaces' => true]);
?>

                    <?php 
echo $form->field($model, 'slug')->textInput(['maxlength' => true]);
?>

                    <?php 
echo $form->field($model, 'description')->textarea(['rows' => 6]);
?>

                </div>
            </div>
        </div>

        <div class="col-md-3">