Ejemplo n.º 1
0
    echo $lang['label'];
    ?>
 <span class="badge"><?php 
    echo $lang['count'];
    ?>
</span>
                </a>
            </li>
        <?php 
}
?>
    </ul>

    <?php 
foreach ($models->models as $model) {
    echo Paste::widget(['model' => $model, 'actions' => [\yii\helpers\Html::a('<span class="glyphicon glyphicon-thumbs-up"></span>', ['site/vote', 'id' => $model->id, 'vote' => 'up'], ['class' => 'btn btn-success vote-up' . ($model->canVote ? '' : ' disabled'), 'rel' => 'nofollow']), \yii\helpers\Html::a('<span class="glyphicon glyphicon-thumbs-down"></span>', ['site/vote', 'id' => $model->id, 'vote' => 'down'], ['class' => 'btn btn-danger vote-down' . ($model->canVote ? '' : ' disabled'), 'rel' => 'nofollow']), \yii\helpers\Html::a('Comments', ['site/paste', 'id' => $model->id, '#' => 'disqus_thread'], ['class' => 'btn btn-info'])]]);
}
?>

    <?php 
echo \yii\widgets\LinkPager::widget(['pagination' => $models->pagination]);
?>
</div>
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES * * */
    var disqus_shortname = 'shit-code';

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function () {
        var s = document.createElement('script'); s.async = true;
        s.type = 'text/javascript';
Ejemplo n.º 2
0
use app\models\Code;
use app\widgets\Paste;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $pending \yii\data\ActiveDataProvider */
$this->title = Yii::t('happycode', 'Pending pastes');
$this->params['breadcrumbs'][] = $this->title;
$parsedown = Parsedown::instance();
?>
<div class="alerts">

</div>
<?php 
/** @var Code $paste */
foreach ($pending->models as $paste) {
    echo Paste::widget(['model' => $paste, 'actions' => [\yii\helpers\Html::a('<span aria-hidden="true" class="glyphicon glyphicon-ok"></span> Approve', ['admin/change-status', 'id' => $paste->id, 'status' => 1], ['class' => 'btn btn-success accept-action', 'data-id' => $paste->id]), \yii\helpers\Html::a('<span aria-hidden="true" class="glyphicon glyphicon-remove"></span> Decline', ['admin/change-status', 'id' => $paste->id, 'status' => -1], ['class' => 'btn btn-danger decline-action', 'data-id' => $paste->id])]]);
}
?>

<?php 
echo \yii\widgets\LinkPager::widget(['pagination' => $pending->pagination]);
?>

<?php 
$url = \yii\helpers\Url::to(['admin/change-status']);
$script = <<<JS
\$('.accept-action, .decline-action').on('click', function(e) {
    \$.ajax({
        url: '{$url}',
        data: {
            id: \$(this).data('id'),