コード例 #1
0
ファイル: index.php プロジェクト: oakcms/oakcms
use app\modules\text\models\Text;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\text\models\search\TextSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('carousel', 'Texts');
$this->params['breadcrumbs'][] = $this->title;
$this->params['actions_buttons'] = [['tagName' => 'a', 'label' => Yii::t('carousel', 'Create'), 'options' => ['href' => Url::to(['create'])], 'icon' => 'fa fa-plus', 'iconPosition' => Button::ICON_POSITION_LEFT, 'size' => Button::SIZE_SMALL, 'disabled' => false, 'block' => false, 'type' => Button::TYPE_CIRCLE], ['label' => Yii::t('app', 'Control'), 'options' => ['class' => 'btn blue btn-outline btn-circle btn-sm', 'data-hover' => "dropdown", 'data-close-others' => "true"], 'dropdown' => ['options' => ['class' => 'pull-right'], 'encodeLabels' => false, 'items' => [['label' => '<span class="font-red"><i class="fa fa-trash-o"></i> ' . Yii::t('app', 'Delete') . '</span>', 'url' => 'javascript:void(0)', 'linkOptions' => ['onclick' => 'deleteA()']], ['label' => '<span class="font-green-turquoise"><i class="fa fa-toggle-on"></i> ' . Yii::t('app', 'Published') . '</span>', 'url' => 'javascript:void(0)', 'linkOptions' => ['onclick' => 'publishedA()']], ['label' => '<span class="font-blue-chambray"><i class="fa fa-toggle-off"></i> ' . Yii::t('app', 'Unpublished') . '</span>', 'url' => 'javascript:void(0)', 'linkOptions' => ['onclick' => 'unpublishedA()']]]]]];
?>
<div class="text-index">

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <div class="table-responsive">
        <?php 
echo \himiklab\sortablegrid\SortableGridView::widget(['id' => 'grid', 'tableOptions' => ['class' => 'table table-striped table-bordered table-advance table-hover'], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['style' => 'width:36px']], ['attribute' => 'id', 'options' => ['style' => 'width:100px']], 'title', 'subtitle', 'layout', 'slug', ['class' => \app\modules\admin\components\grid\EnumColumn::className(), 'attribute' => 'status', 'format' => 'raw', 'options' => ['width' => '50px'], 'value' => function ($model, $index, $widget) {
    return Html::checkbox('', $model->status == Text::STATUS_PUBLISHED, ['class' => 'switch toggle', 'data-id' => $model->primaryKey, 'data-link' => \yii\helpers\Url::to(['/admin/text/default']), 'data-reload' => '0']);
}, 'enum' => [Yii::t('app', 'Off'), Yii::t('app', 'On')]], ['class' => 'app\\modules\\admin\\components\\grid\\ActionColumn', 'translatable' => true]]]);
?>
    </div>
</div>
<script>
    function deleteA() {
        var keys = $('#grid').yiiGridView('getSelectedRows');
        window.location.href = '<?php 
echo Url::to(['/admin/text/default/delete-ids']);
?>
' + '?id=' + keys.join();
    }
    function publishedA() {
        var keys = $('#grid').yiiGridView('getSelectedRows');
コード例 #2
0
ファイル: index.php プロジェクト: oakcms/oakcms
$this->params['breadcrumbs'][] = $this->title;
$this->params['actions_buttons'] = [['tagName' => 'a', 'label' => Yii::t('admin', 'Create'), 'options' => ['href' => Url::to(['create'])], 'icon' => 'fa fa-plus', 'iconPosition' => Button::ICON_POSITION_LEFT, 'size' => Button::SIZE_SMALL, 'disabled' => false, 'block' => false, 'type' => Button::TYPE_CIRCLE], ['label' => Yii::t('app', 'Control'), 'options' => ['class' => 'btn blue btn-outline btn-circle btn-sm', 'data-hover' => "dropdown", 'data-close-others' => "true"], 'dropdown' => ['options' => ['class' => 'pull-right'], 'encodeLabels' => false, 'items' => [['label' => '<span class="font-red"><i class="fa fa-trash-o"></i> ' . Yii::t('app', 'Delete') . '</span>', 'url' => 'javascript:void(0)', 'linkOptions' => ['onclick' => 'deleteA()']], ['label' => '<span class="font-green-turquoise"><i class="fa fa-toggle-on"></i> ' . Yii::t('app', 'Published') . '</span>', 'url' => 'javascript:void(0)', 'linkOptions' => ['onclick' => 'publishedA()']], ['label' => '<span class="font-blue-chambray"><i class="fa fa-toggle-off"></i> ' . Yii::t('app', 'Unpublished') . '</span>', 'url' => 'javascript:void(0)', 'linkOptions' => ['onclick' => 'unpublishedA()']]]]]];
?>
<div class="content-articles-index">

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <div class="table-responsive">
        <?php 
\yii\widgets\Pjax::begin();
?>
        <?php 
echo GridView::widget(['id' => 'grid', 'tableOptions' => ['class' => 'table table-striped table-bordered table-advance table-hover'], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['style' => 'width:36px']], ['attribute' => 'id', 'options' => ['style' => 'width:100px']], 'title', 'slug', ['attribute' => 'category_id', 'format' => 'raw', 'filter' => Html::activeDropDownList($searchModel, 'category_id', \yii\helpers\ArrayHelper::map(\app\modules\content\models\ContentCategory::find()->published()->all(), 'id', 'title'), ['class' => 'form-control', 'prompt' => Yii::t('admin', 'Select Category')]), 'value' => function ($model, $index, $widget) {
    return $model->category->title;
}], 'published_at:datetime', ['class' => \app\modules\admin\components\grid\EnumColumn::className(), 'attribute' => 'status', 'format' => 'raw', 'options' => ['width' => '50px'], 'value' => function ($model, $index, $widget) {
    return Html::checkbox('', $model->status == ContentArticles::STATUS_PUBLISHED, ['class' => 'switch toggle', 'data-id' => $model->primaryKey, 'data-link' => \yii\helpers\Url::to(['/admin/content/article']), 'data-reload' => '0']);
}, 'enum' => [Yii::t('app', 'Off'), Yii::t('app', 'On')]], ['class' => 'app\\modules\\admin\\components\\grid\\ActionColumn', 'translatable' => true]]]);
?>
        <?php 
\yii\widgets\Pjax::end();
?>
    </div>
</div>
<script>
    function deleteA() {
        var keys = $('#grid').yiiGridView('getSelectedRows');
        window.location.href = '/admin/content/article/delete-ids?id=' + keys.join();
    }
    function publishedA() {
        var keys = $('#grid').yiiGridView('getSelectedRows');
コード例 #3
0
ファイル: index.php プロジェクト: oakcms/oakcms
use yii\helpers\Url;
use yii\helpers\Html;
use yii\grid\GridView;
use app\modules\admin\widgets\Button;
use app\modules\language\models\Language;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('language', 'Languages');
$this->params['breadcrumbs'][] = $this->title;
$this->params['actions_buttons'] = [['tagName' => 'a', 'label' => Yii::t('language', 'Create'), 'options' => ['href' => Url::to(['create'])], 'icon' => 'fa fa-plus', 'iconPosition' => Button::ICON_POSITION_LEFT, 'size' => Button::SIZE_SMALL, 'disabled' => false, 'block' => false, 'type' => Button::TYPE_CIRCLE], ['label' => Yii::t('app', 'Control'), 'options' => ['class' => 'btn blue btn-outline btn-circle btn-sm', 'data-hover' => "dropdown", 'data-close-others' => "true"], 'dropdown' => ['options' => ['class' => 'pull-right'], 'encodeLabels' => false, 'items' => [['label' => '<span class="font-red"><i class="fa fa-trash-o"></i> ' . Yii::t('app', 'Delete') . '</span>', 'url' => 'javascript:void(0)', 'linkOptions' => ['onclick' => 'deleteA()']], ['label' => '<span class="font-green-turquoise"><i class="fa fa-toggle-on"></i> ' . Yii::t('app', 'Published') . '</span>', 'url' => 'javascript:void(0)', 'linkOptions' => ['onclick' => 'publishedA()']], ['label' => '<span class="font-blue-chambray"><i class="fa fa-toggle-off"></i> ' . Yii::t('app', 'Unpublished') . '</span>', 'url' => 'javascript:void(0)', 'linkOptions' => ['onclick' => 'unpublishedA()']]]]]];
?>
<div class="language-index">

    <div class="table-responsive">
        <?php 
echo GridView::widget(['id' => 'grid', 'tableOptions' => ['class' => 'table table-striped table-bordered table-advance table-hover'], 'dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['style' => 'width:36px']], ['attribute' => 'language_id', 'options' => ['style' => 'width:100px']], 'language', 'country', 'url:url', 'name', ['class' => \app\modules\admin\components\grid\EnumColumn::className(), 'attribute' => 'status', 'format' => 'raw', 'options' => ['width' => '50px'], 'value' => function ($model, $index, $widget) {
    return Html::checkbox('', $model->status == Language::STATUS_PUBLISHED, ['class' => 'switch toggle', 'data-id' => $model->primaryKey, 'data-link' => \yii\helpers\Url::to(['/admin/language/language']), 'data-reload' => '0']);
}, 'enum' => [Yii::t('app', 'Off'), Yii::t('app', 'On')]], ['class' => 'app\\modules\\admin\\components\\grid\\ActionColumn']]]);
?>
    </div>
</div>
<script>
    function deleteA() {
        var keys = $('#grid').yiiGridView('getSelectedRows');
        window.location.href = '<?php 
echo Yii::$app->homeUrl;
?>
admin/language/language/delete-ids?id=' + keys.join();
    }
    function publishedA() {
        var keys = $('#grid').yiiGridView('getSelectedRows');