Example #1
0
 public function testIconOutput()
 {
     $this->assertEquals(FA::i('cog'), '<i class="fa fa-cog"></i>');
     $this->assertEquals(FA::icon('cog'), '<i class="fa fa-cog"></i>');
     $this->assertEquals(FA::icon('cog')->tag('span'), '<span class="fa fa-cog"></span>');
     $this->assertEquals(FA::icon('cog')->addCssClass('highlight'), '<i class="fa fa-cog highlight"></i>');
     $this->assertEquals(FA::icon('cog')->inverse(), '<i class="fa fa-cog fa-inverse"></i>');
     $this->assertEquals(FA::icon('cog')->spin(), '<i class="fa fa-cog fa-spin"></i>');
     $this->assertEquals(FA::icon('cog')->fixedWidth(), '<i class="fa fa-cog fa-fw"></i>');
     $this->assertEquals(FA::icon('cog')->fixed_width(), '<i class="fa fa-cog fa-fw"></i>');
     $this->assertEquals(FA::icon('cog')->ul(), '<i class="fa fa-cog fa-ul"></i>');
     $this->assertEquals(FA::icon('cog')->li(), '<i class="fa fa-cog fa-li"></i>');
     $this->assertEquals(FA::icon('cog')->border(), '<i class="fa fa-cog fa-border"></i>');
     $this->assertEquals(FA::icon('cog')->pullLeft(), '<i class="fa fa-cog pull-left"></i>');
     $this->assertEquals(FA::icon('cog')->pull_left(), '<i class="fa fa-cog pull-left"></i>');
     $this->assertEquals(FA::icon('cog')->pullRight(), '<i class="fa fa-cog pull-right"></i>');
     $this->assertEquals(FA::icon('cog')->pull_right(), '<i class="fa fa-cog pull-right"></i>');
     $this->assertEquals(FA::icon('cog')->size(FA::SIZE_2X), '<i class="fa fa-cog fa-2x"></i>');
     $this->assertEquals(FA::icon('cog')->size(FA::SIZE_3X), '<i class="fa fa-cog fa-3x"></i>');
     $this->assertEquals(FA::icon('cog')->size(FA::SIZE_4X), '<i class="fa fa-cog fa-4x"></i>');
     $this->assertEquals(FA::icon('cog')->size(FA::SIZE_5X), '<i class="fa fa-cog fa-5x"></i>');
     $this->assertEquals(FA::icon('cog')->size(FA::SIZE_LARGE), '<i class="fa fa-cog fa-lg"></i>');
     $this->assertEquals(FA::icon('cog')->rotate(FA::ROTATE_90), '<i class="fa fa-cog fa-rotate-90"></i>');
     $this->assertEquals(FA::icon('cog')->rotate(FA::ROTATE_180), '<i class="fa fa-cog fa-rotate-180"></i>');
     $this->assertEquals(FA::icon('cog')->rotate(FA::ROTATE_270), '<i class="fa fa-cog fa-rotate-270"></i>');
     $this->assertEquals(FA::icon('cog')->flip(FA::FLIP_HORIZONTAL), '<i class="fa fa-cog fa-flip-horizontal"></i>');
     $this->assertEquals(FA::icon('cog')->flip(FA::FLIP_VERTICAL), '<i class="fa fa-cog fa-flip-vertical"></i>');
 }
 protected function initDefaultButtons()
 {
     //        $this->template = '<div class="btn-group">' . $this->template . '</div>';
     if (!isset($this->buttons['view'])) {
         $this->buttons['view'] = function ($url, $model, $key) {
             return Html::a(FA::i('eye'), $url, array_merge(['title' => Yii::t('yii', 'View'), 'class' => 'btn btn-default btn-xs'], $this->buttonOptions));
         };
     }
     if (!isset($this->buttons['update'])) {
         $this->buttons['update'] = function ($url, $model, $key) {
             return Html::a(FA::i('edit'), $url, array_merge(['title' => Yii::t('yii', 'Update'), 'class' => 'btn btn-primary btn-xs'], $this->buttonOptions));
         };
     }
     if (!isset($this->buttons['delete'])) {
         $this->buttons['delete'] = function ($url, $model, $key) {
             return Html::a(FA::i('trash'), $url, array_merge(['title' => Yii::t('yii', 'Delete'), 'class' => 'btn btn-danger btn-xs', 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post'], $this->buttonOptions));
         };
     }
 }
Example #3
0
<?php

use rmrevin\yii\fontawesome\FA;
use yii\bootstrap\Html;
$subcategories = [];
echo Html::tag('div', Html::tag('div', Html::tag('span', !empty($category->image) ? Html::tag('div', FA::i($category->image), ['class' => 'category-icon-box', 'style' => 'background-color: ' . $category->color]) : '', ['class' => 'category-icon']) . Html::tag('span', Html::a(Html::tag('h4', $category->name), $category->link), ['class' => 'cat-title']) . Html::tag('span', Html::tag('h4', $category->postsCount), ['class' => 'category-total']), ['class' => 'category-header']) . Html::tag('div', Html::tag('ul', implode('', $subcategories)), ['class' => 'category-content']), ['class' => 'category-box span3' . ($current % 4 == 0 ? ' first' : '')]);
Example #4
0
$js = <<<'JS'
$("body").on('click', '.saveBtn', function(){
    $("#edit-menu-form").submit();
});
JS;
$act = '';
if (($act = \Yii::$app->request->get('act')) && ($act = 'edit')) {
    $this->registerJs($js);
}
$this->title = ($act == 'edit' ? 'Редактирование' : 'Просмотр') . ' пунктов меню';
$this->params['breadcrumbs'][] = ['url' => '/menu', 'label' => 'Менеджер меню'];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
if ($act == 'edit') {
    echo Html::a(FA::i('arrow-left') . Html::tag('small', 'Назад'), ['/menu/view/' . $menu->id], ['class' => 'btn btn-app']), Html::button(FA::i('save') . Html::tag('small', 'Сохранить'), ['class' => 'btn btn-app saveBtn']);
} else {
    echo Html::a(FA::i('arrow-left') . Html::tag('small', 'Назад'), ['/menu'], ['class' => 'btn btn-app']), Html::a(FA::i('pencil') . Html::tag('small', 'Редактировать'), ['/menu/view/' . $menu->id, 'act' => 'edit'], ['class' => 'btn btn-app']);
}
?>
    </div>
    <div class="panel-body">
        <div class="col-xs-8 col-xs-offset-2">
            <?php 
echo '';
?>
        </div>
    </div>
</div>
Example #5
0
    $.ajax({
        url: '/rss/toggle',
        method: 'post',
        data: {
            attribute: 'published',
            value: enabled ? false : true,
            key: button.closest('tr').attr('data-key')
        },
        success: function(data){
            button.toggleClass('btn-success')
                .toggleClass('btn-danger')
                .find('i')
                .toggleClass('fa-eye')
                .toggleClass('fa-eye-slash');
        } 
    });
});
JS;
$this->registerJs($js);
$this->title = 'Менеджер RSS';
echo Html::tag('div', Html::tag('div', Html::tag('div', Html::a(FA::i('plus') . Html::tag('small', 'Добавить'), ['/rss/add'], ['class' => 'btn btn-app']), ['class' => 'row col-xs-12']) . Html::tag('div', '', ['class' => 'clearfix']), ['class' => 'panel-heading']) . Html::tag('div', GridView::widget(['dataProvider' => $feeds, 'summary' => false, 'bordered' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'export' => false, 'resizableColumns' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'tableOptions' => ['class' => 'gridWithLongText'], 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'columns' => [['attribute' => 'name', 'format' => 'raw', 'width' => '180px', 'hAlign' => GridView::ALIGN_LEFT, 'vAlign' => GridView::ALIGN_MIDDLE], ['attribute' => 'description', 'format' => 'raw', 'hAlign' => GridView::ALIGN_LEFT, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::tag('span', $model->description, ['class' => 'longText']);
}], ['attribute' => 'created', 'width' => '110px', 'contentOptions' => ['style' => 'white-space: normal'], 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->created);
}], ['class' => \kartik\grid\ActionColumn::className(), 'width' => '120px', 'buttons' => ['published' => function ($key, $model) {
    return Html::button(FA::i($model->published ? 'eye' : 'eye-slash'), ['class' => 'btn togglePublished btn-' . ($model->published ? 'success' : 'danger')]);
}, 'view' => function ($key, $model) {
    return Html::a(FA::i('globe'), \Yii::$app->params['frontend'] . '/rss/' . $model->fullLink, ['class' => 'btn btn-default', 'title' => 'Просмотреть на сайте']);
}, 'edit' => function () {
    return Html::button(FA::i('pencil'), ['class' => 'btn btn-default editRssFeed', 'title' => 'Редактировать']);
}], 'template' => Html::tag('div', '{edit}{view}{published}', ['class' => 'btn-group btn-group-sm'])]]]), ['class' => 'panel-body']) . Html::tag('div', '', ['class' => 'clearfix']), ['class' => 'panel panel-default']) . $this->render('edit', ['model' => new \backend\modules\rss\models\NewsFeedForm()]);
Example #6
0
?>
        </div>
        <ul class="list-group page-items-list" id="pageItemsList">
            <?php 
foreach ($model->items_list as $item) {
    ?>
                <li class="list-group-item">
                    <button type="button"
                            class="btn btn-danger btn-xs"
                            data-action="remove-block"
                            data-id="">
                        <i class="fa fa-close"></i>
                    </button>

                    <?php 
    echo Html::a(FA::i(FA::_COG), ['/cms/admin/block/update', 'id' => $item->block_id, 'page_id' => $model->id], ['class' => 'btn btn-xs btn-success']);
    ?>

                    <?php 
    if ($item->block) {
        ?>
                        <i class="fa fa-<?php 
        echo $item->block->isPublic() ? FA::_EYE : FA::_EYE_SLASH;
        ?>
"></i>
                    <?php 
    }
    ?>

                    <input type="hidden" name="PageHasBlock[<?php 
    echo $item->id;
Example #7
0
        ?>
                            </div>
                            <div class="panel-body">
                                <?php 
        echo Html::a(Html::img(Yii::getAlias('@web/images/' . $user->id . '/thumbnail_' . $photo->filename), ['class' => 'img-responsive', 'data-photo-id' => $photo->id, 'alt' => '#' . $photo->id . ' - ' . $photo->filename]), Yii::getAlias('@web/images/' . $user->id . '/' . $photo->filename), ['data-gallery' => true, 'data-photo' => $photo->id, 'title' => '#' . $photo->id . ' - ' . $photo->filename]);
        ?>
                            </div>
                        </div>
                    </div>
                <?php 
    }
    ?>
            </div>

            <a class="btn btn-success btn-block btn-send btn-lg"><?php 
    echo FA::i('send');
    ?>
 Отправить</a>
        </div>
    <?php 
} else {
    ?>
        <div class="alert alert-warning">Скоро здесь появятся фото ;)</div>
    <?php 
}
?>
</div>

<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls">
    <div class="slides"></div>
    <h3 class="title"></h3>
Example #8
0
echo Html::a(FontAwesome::i('plus') . Html::tag('small', 'Добавить'), Url::toRoute(['/news/new']), ['class' => 'btn btn-app']), Html::button(FontAwesome::i('eye') . Html::tag('small', 'Опубликовать'), ['class' => 'btn publishChecked btn-app']), Html::button(FontAwesome::i('eye-slash') . Html::tag('small', 'Скрыть'), ['class' => 'btn unpublishChecked btn-app']), Html::button(FontAwesome::i('trash') . Html::tag('small', 'Удалить'), ['class' => 'btn deleteChecked btn-app']), Html::button(FontAwesome::i('trash-o') . Html::tag('small', 'Восстановить'), ['class' => 'btn restoreChecked btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo GridView::widget(['dataProvider' => $newsDataProvider, 'bordered' => false, 'export' => false, 'summary' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'resizableColumns' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'id' => 'newsGrid', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'tableOptions' => ['class' => 'gridWithLongText'], 'columns' => [['class' => \yii\grid\CheckboxColumn::className(), 'options' => ['style' => 'width: 30px'], 'contentOptions' => ['style' => 'vertical-align: middle']], ['attribute' => 'title', 'format' => 'html', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::a($model->title, ['/news/show/' . $model->id], ['class' => 'longText']);
}], ['attribute' => 'categoryID', 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '180px', 'value' => function ($model) {
    if (empty($model)) {
        return '';
    }
    return $model->category->title;
}], ['attribute' => 'publishDate', 'label' => 'Опубликовано', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '120px', 'value' => function ($model) {
    return \Yii::$app->formatter->asDate($model->publishDate);
}], ['attribute' => 'hits', 'width' => '90px', 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    $views = $model->hits;
    if ($todayViews = $model->todayViews) {
        $views .= Html::tag('span', " (+{$todayViews->views})", ['class' => 'text-success', 'data-toggle' => 'tooltip', 'title' => 'Просмотры за сегодня']);
    }
    return $views;
}], ['class' => \kartik\grid\ActionColumn::className(), 'template' => Html::tag('div', '{edit}{published}{deleted}', ['class' => 'btn-group btn-group-sm']), 'width' => '120px', 'buttons' => ['edit' => function ($key, $model) {
    return Html::a(\rmrevin\yii\fontawesome\FA::i('pencil'), ['/news/show/' . $model->id, 'act' => 'edit'], ['class' => 'btn btn-default']);
}, 'published' => function ($key, $model) {
    return Html::button(\rmrevin\yii\fontawesome\FA::i('eye' . ($model->published ? '' : '-slash')), ['class' => 'btn togglePublished btn-' . ($model->published ? 'success' : 'danger')]);
}, 'deleted' => function ($key, $model) {
    return Html::button(\rmrevin\yii\fontawesome\FA::i('trash' . ($model->deleted ? '' : '-o')), ['class' => 'btn toggleDeleted btn-' . ($model->deleted ? 'danger' : 'success')]);
}]]]]);
?>
    </div>
    <div class="clearfix"></div>
</div>
Example #9
0
                <div class="panel <?php 
    echo $photo->selected ? 'panel-primary' : 'panel-default';
    ?>
 text-center panel-photo">
                    <div class="panel-heading">
                        #<?php 
    echo $photo->id;
    ?>
 - <?php 
    echo $photo->filename;
    ?>
                        <a class="btn btn-danger btn-xs btn-remove-photo" data-photo-id="<?php 
    echo $photo->id;
    ?>
" data-loading-text="Загрузка"><?php 
    echo FA::i('remove');
    ?>
</a>
                    </div>
                    <div class="panel-body">
                        <?php 
    echo Html::a(Html::img(Yii::getAlias('@web/images/' . $model->id . '/thumbnail_' . $photo->filename), ['class' => 'img-responsive', 'alt' => '#' . $photo->id . ' - ' . $photo->filename]), Yii::getAlias('@web/images/' . $model->id . '/' . $photo->filename), ['data-gallery' => true, 'title' => '#' . $photo->id . ' - ' . $photo->filename]);
    ?>
                    </div>
                </div>
            </div>
        <?php 
}
?>
    </div>
</div>
Example #10
0
        <?php 
echo Html::tag('span', Html::a($comment->author, '#') . "&nbsp;" . Html::tag('small', $comment->email), ['class' => 'username']) . "&nbsp;";
?>

        <span class="pull-right" style="margin-top: -10px;">
            <?php 
echo !empty($comment->isGood) ? Html::tag('span', "+{$comment->isGood}", ['class' => 'text-green']) : '';
?>
            <?php 
echo !empty($comment->isBad) ? Html::tag('span', "-{$comment->isBad}", ['class' => 'text-red']) : '';
?>
        </span>
    </div>
    <?php 
echo Html::tag('span', "{$comment->ip} - " . \Yii::$app->formatter->asDatetime($comment->date), ['class' => 'description', 'style' => 'margin-top: -20px;']);
?>
</div>
<?php 
echo Html::tag('p', $comment->text);
if ($showButtons) {
    echo Html::button(FA::i($comment->published == 1 ? 'eye' : 'eye-slash'), ['class' => 'publishComment btn btn-sm btn-default']) . "&nbsp;" . Html::button(FA::i($comment->deleted == 1 ? 'reply' : 'trash'), ['class' => 'deleteComment btn btn-sm btn-default']) . "&nbsp;" . Html::button(FA::i('pencil'), ['class' => 'editComment btn btn-sm btn-default']);
} else {
    ?>

    <?php 
    echo $comment->deleted == 1 ? Html::tag('span', 'Удалено', ['class' => 'label bg-red']) : '';
    ?>
&nbsp;
    <?php 
    echo $comment->published == 0 ? Html::tag('span', 'Скрыто', ['class' => 'label bg-yellow']) : '';
}
Example #11
0
$customerModal = new \bobroid\remodal\Remodal(['addRandomToID' => false, 'id' => 'addUser', 'confirmButton' => false, 'cancelButton' => false]);
echo $customerModal->renderModal($this->render('_new_user', ['model' => new \backend\models\SiteuserForm()]));
?>

<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FA::i('plus') . Html::tag('small', 'Добавить'), '#addUser', ['class' => 'btn btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo GridView::widget(['dataProvider' => $siteusersDataProvider, 'summary' => false, 'bordered' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'export' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'columns' => [['vAlign' => GridView::ALIGN_MIDDLE, 'class' => SerialColumn::className()], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '200px', 'attribute' => 'username'], ['vAlign' => GridView::ALIGN_MIDDLE, 'attribute' => 'email'], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '100px', 'attribute' => 'status', 'value' => function ($model) {
    if ($model->status == $model::STATUS_ACTIVE) {
        return 'Активен';
    }
    return 'Не активен';
}], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '160px', 'attribute' => 'created_at', 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->created_at);
}], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '150px', 'attribute' => 'last_visit', 'value' => function ($model) {
    return \Yii::$app->formatter->asRelativeTime($model->last_visit);
}], ['vAlign' => GridView::ALIGN_MIDDLE, 'width' => '100px', 'class' => \kartik\grid\ActionColumn::className(), 'template' => Html::tag('div', '{edit}{status}', ['class' => 'btn-group']), 'buttons' => ['edit' => function () {
    return Html::button(FA::i('pencil'), ['class' => 'btn btn-default editUser', 'title' => 'Редактировать']);
}, 'status' => function ($key, $model) {
    $active = $model->status == $model::STATUS_ACTIVE;
    return Html::button(FA::i($active ? 'unlock' : 'lock'), ['class' => 'btn changeStatus btn-' . ($active ? 'success' : 'danger')]);
}]]]]);
?>

    </div>
</div>
Example #12
0
?>
</span>

                <div class="info-box-content">
                    <span class="info-box-text">Статей</span>
                    <span class="info-box-number"><?php 
echo $newsCount;
?>
</span>
                </div>
            </div>
        </div>
        <div class="col-xs-4">
            <div class="info-box">
                <span class="info-box-icon bg-yellow"><?php 
echo FA::i('comments-o');
?>
</span>

                <div class="info-box-content">
                    <span class="info-box-text">Комментариев</span>
                    <span class="info-box-number"><?php 
echo $commentsCount;
?>
</span>
                    <?php 
echo Html::a('смотреть', ['/comments/default/index', 'smartFilter' => 'moderated'], ['class' => 'progress-description']);
?>
                </div>
            </div>
        </div>
Example #13
0
<?php

use rmrevin\yii\fontawesome\FA;
use yii\helpers\Html;
?>
<div itemprop="comment" itemscope="itemscope" itemtype="http://schema.org/Comment" class="comment-box">
    <span class="comments-vote">
	    <span id="comment-vote-holder-<?php 
echo $model->id;
?>
" data-attribute-commentID="<?php 
echo $model->id;
?>
">
            <?php 
echo Html::button(FA::i('thumbs-up'), ['title' => 'Хороший комментарий!', 'class' => 'vote-good', $model->hasVoted && $model->hasVoted == 1 ? 'disabled' : 'enabled' => 'disabled']) . '&nbsp;&nbsp;' . Html::button(FA::i('thumbs-down'), ['title' => 'Плохой комментарий!', 'class' => 'vote-poor', $model->hasVoted && $model->hasVoted == -1 ? 'disabled' : 'enabled' => 'disabled']), Html::tag('span', sprintf("%+d", $model->rating), ['class' => 'vote-result vote-' . ($model->rating != 0 ? $model->rating > 0 ? 'good' : 'poor' : 'neutrall')]);
?>
	    </span>
    </span>
    <a class="comment-anchor" id="comment-<?php 
echo $model->id;
?>
">#<?php 
echo $pos;
?>
</a>
    <span itemprop="creator" class="comment-author"><?php 
echo $model->author;
?>
</span>
    <span class="comment-date"><?php 
Example #14
0
    }
});
JS;
$this->registerJs($js);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FontAwesome::i('plus') . Html::tag('small', 'Добавить'), Url::toRoute(['/categories/add']), ['class' => 'btn btn-app']), Html::button(FontAwesome::i('eye') . Html::tag('small', 'Опубликовать'), ['class' => 'btn publishChecked btn-app']), Html::button(FontAwesome::i('eye-slash') . Html::tag('small', 'Скрыть'), ['class' => 'btn unpublishChecked btn-app']), Html::button(FontAwesome::i('trash') . Html::tag('small', 'Удалить'), ['class' => 'btn deleteChecked btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo \kartik\grid\GridView::widget(['dataProvider' => $dataProvider, 'bordered' => false, 'summary' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'export' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'containerOptions' => ['class' => 'box-body table-responsive no-padding', 'style' => 'padding: 0'], 'resizableColumns' => false, 'columns' => [['class' => \kartik\grid\CheckboxColumn::className()], 'title', ['attribute' => 'parent', 'value' => function ($model) {
    if (empty($model->parentCategory)) {
        return ' ';
    }
    return $model->parentCategory->title;
}], ['attribute' => 'created', 'value' => function ($model) {
    return \Yii::$app->formatter->asDatetime($model->created);
}], ['label' => 'Создатель'], ['class' => \kartik\grid\ActionColumn::className(), 'width' => '120px', 'template' => Html::tag('div', '{edit}{publish}{delete}', ['class' => 'btn-group btn-group-sm']), 'buttons' => ['edit' => function ($key, $model) {
    return Html::a(FA::i('pencil'), '/categories/edit/' . $model->id, ['class' => 'btn btn-default']);
}, 'publish' => function ($key, $model) {
    return Html::button(FA::i('eye' . ($model->published ? '' : '-slash')), ['class' => 'btn togglePublished btn-' . ($model->published ? 'success' : 'danger')]);
}, 'delete' => function ($key, $model) {
    return Html::button(FA::i('trash' . ($model->deleted ? '' : '-o')), ['class' => 'btn toggleDeleted btn-' . ($model->deleted ? 'danger' : 'success')]);
}]]]]);
?>
    </div>
    <div class="clearfix"></div>
</div>
Example #15
0
/** @var \backend\modules\announcements\models\AnnouncementForm $model */
use rmrevin\yii\fontawesome\FA;
use yii\bootstrap\Html;
$this->title = 'Редактирование анонса';
$this->params['breadcrumbs'][] = ['url' => ['/announcements/default/index'], 'label' => 'Анонсы'];
$this->params['breadcrumbs'][] = $this->title;
$js = <<<'JS'
$("body").on('click', '.saveBtn', function(){
    $("#edit-announcement-form").submit();
});
JS;
$this->registerJs($js);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FA::i('arrow-left') . Html::tag('small', 'Назад'), ['/announcements'], ['class' => 'btn btn-app']);
?>
        <?php 
echo Html::button(FA::i('save') . Html::tag('small', 'Сохранить'), ['class' => 'btn btn-app saveBtn']);
?>
    </div>
    <div class="panel-body">
        <div class="col-xs-8 col-xs-offset-2">
            <?php 
echo $this->render('editForm', ['model' => $model]);
?>
        </div>
    </div>
</div>
Example #16
0
<?php

use kartik\grid\GridView;
use rmrevin\yii\fontawesome\FA;
use yii\helpers\Html;
$this->title = 'Менеджер меню';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::a(FA::i('plus') . Html::tag('small', 'Добавить'), ['add'], ['class' => 'btn btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo GridView::widget(['dataProvider' => $menus, 'summary' => false, 'bordered' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'export' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'columns' => [['attribute' => 'name'], 'alias', ['class' => \kartik\grid\ActionColumn::className(), 'width' => '110px', 'buttons' => ['view' => function ($key, $model) {
    return Html::a(FA::i('eye'), '/menu/view/' . $model->id, ['class' => 'btn btn-default']);
}, 'edit' => function ($key, $model) {
    return Html::a(FA::i('pencil'), '/menu/edit/' . $model->id, ['class' => 'btn btn-default']);
}], 'template' => Html::tag('div', '{edit}{view}', ['class' => 'btn-group'])]], 'resizableColumns' => false]);
?>
    </div>
</div>
Example #17
0
                            <button type="button" class="btn btn-default btn-sm checkUnpublish"><i class="fa fa-eye-slash"></i></button>
                        </div>
                        <button type="button" class="btn btn-default btn-sm checkSeed"><i class="fa fa-check"></i></button>', 'footer' => '<div class="btn-group">
                            <button type="button" class="btn btn-default btn-sm checkDeleted"><i class="fa fa-trash-o"></i></button>
                            <button type="button" class="btn btn-default btn-sm checkPublish"><i class="fa fa-eye"></i></button>
                            <button type="button" class="btn btn-default btn-sm checkUnpublish"><i class="fa fa-eye-slash"></i></button>
                        </div>
                        <button type="button" class="btn btn-default btn-sm checkSeed"><i class="fa fa-check"></i></button>'], 'panelTemplate' => '<div class="panel {type}">{panelHeading}{items}{panelFooter}<div class="text-center">{pager}</div></div>', 'panelFooterTemplate' => '{footer}<div class="clearfix"></div>', 'dataProvider' => $comments, 'bordered' => false, 'summary' => false, 'hover' => true, 'id' => 'commentsGrid', 'pjax' => true, 'pjaxSettings' => ['linkSelector' => '#commentsGrid .pagination a'], 'striped' => false, 'layout' => '{items}', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'resizableColumns' => false, 'columns' => [['class' => \kartik\grid\CheckboxColumn::className()], ['format' => 'raw', 'attribute' => 'author', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::tag('span', $model->author, ['title' => "IP: {$model->ip} email: {$model->email}", 'data-toggle' => 'tooltip']);
}], ['label' => 'Статья', 'format' => 'raw', 'value' => function ($model) {
    if (empty($model->news)) {
        return 'отсутствует';
    }
    return Html::a($model->news->title, '/news/show/' . $model->news->id, ['class' => 'longLink newsTitle']);
}], ['attribute' => 'text', 'format' => 'html', 'hAlign' => GridView::ALIGN_LEFT, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::tag('span', $model->text, ['class' => 'longLink commentText']);
}], ['attribute' => 'date', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return \Yii::$app->formatter->asRelativeTime($model->date);
}], ['header' => ' ', 'width' => '100px', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'class' => \kartik\grid\ActionColumn::className(), 'buttons' => ['view' => function ($key, $model) {
    return Html::button(FA::i($model->published == 1 ? 'eye' : 'eye-slash'), ['class' => 'publishComment btn btn-sm btn-default']);
}, 'update' => function ($model) {
    return Html::button(FA::i('pencil'), ['class' => 'editComment btn btn-sm btn-default']);
}], 'template' => Html::tag('div', '{view}{update}', ['class' => 'btn-group btn-group-sm'])]]]);
?>
            </div>
        </div>
    </div>
</div>
<?php 
\yii\widgets\Pjax::end();
echo $this->render('editModal', ['model' => new \backend\modules\comments\models\CommentForm()]);
Example #18
0
echo Html::button(FontAwesome::i('eye') . Html::tag('small', 'Опубликовать'), ['class' => 'btn publishChecked btn-app']), Html::button(FontAwesome::i('eye-slash') . Html::tag('small', 'Скрыть'), ['class' => 'btn unpublishChecked btn-app']), Html::button(FontAwesome::i('trash') . Html::tag('small', 'Удалить'), ['class' => 'btn deleteChecked btn-app']), Html::button(FontAwesome::i('star-o') . Html::tag('small', 'Из избранного'), ['class' => 'btn unfavoriteChecked btn-app']);
?>
    </div>
    <div class="panel-body">
        <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'bordered' => false, 'export' => false, 'summary' => false, 'hover' => true, 'pjax' => true, 'striped' => false, 'resizableColumns' => false, 'layout' => '{items}<div class="text-center">{pager}</div>', 'id' => 'newsGrid', 'containerOptions' => ['class' => 'box-body table-responsive no-padding'], 'tableOptions' => ['class' => 'gridWithLongText'], 'columns' => [['class' => \yii\grid\CheckboxColumn::className(), 'options' => ['style' => 'width: 30px'], 'contentOptions' => ['style' => 'vertical-align: middle']], ['attribute' => 'title', 'format' => 'html', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    return Html::a($model->title, ['/news/show/' . $model->id], ['class' => 'longText']);
}], ['attribute' => 'categoryID', 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '180px', 'value' => function ($model) {
    if (empty($model)) {
        return '';
    }
    return $model->category->title;
}], ['attribute' => 'publishDate', 'label' => 'Опубликовано', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '120px', 'value' => function ($model) {
    return \Yii::$app->formatter->asDate($model->publishDate);
}], ['attribute' => 'hits', 'width' => '90px', 'format' => 'raw', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    $views = $model->hits;
    if ($todayViews = $model->todayViews) {
        $views .= Html::tag('span', " (+{$todayViews->views})", ['class' => 'text-success', 'data-toggle' => 'tooltip', 'title' => 'Просмотры за сегодня']);
    }
    return $views;
}], ['class' => \kartik\grid\ActionColumn::className(), 'template' => Html::tag('div', '{edit}{published}{favorite}', ['class' => 'btn-group btn-group-sm']), 'width' => '120px', 'buttons' => ['edit' => function ($key, $model) {
    return Html::a(\rmrevin\yii\fontawesome\FA::i('pencil'), ['/news/show/' . $model->id, 'act' => 'edit'], ['class' => 'btn btn-default']);
}, 'favorite' => function () {
    return Html::button(\rmrevin\yii\fontawesome\FA::i('star'), ['class' => 'btn btn-success toggleFavorite']);
}, 'published' => function ($key, $model) {
    return Html::button(\rmrevin\yii\fontawesome\FA::i('eye' . ($model->published ? '' : '-slash')), ['class' => 'btn togglePublished btn-' . ($model->published ? 'success' : 'danger')]);
}]]]]);
?>
    </div>
    <div class="clearfix"></div>
</div>