Пример #1
0
use yii\widgets\Pjax;
use yii\bootstrap\Modal;
Modal::begin(['size' => 'modal-sm text-center', 'header' => '<h5>' . Yii::t('app', 'Do you want to delete the ad?') . '</h5>', 'toggleButton' => false, 'closeButton' => false, 'id' => 'delete-element-' . $widget->id]);
echo Html::button(Yii::t('app', 'Yes'), ['class' => 'btn btn-danger', 'style' => 'margin-right: 5px;', 'onclick' => '
        $("#delete-element-' . $widget->id . '").modal("hide");
        $.pjax({
                    type: "POST",
                    url: "' . Url::to(['/ad/view/delete']) . '",
                    container: "#element_container_' . $widget->id . '",
                    data: {id: ' . $widget->id . '},
                    push: false
                })
    ']);
echo Html::button(Yii::t('app', 'No'), ['class' => 'btn btn-success', 'data-dismiss' => 'modal', 'aria-hidden' => 'true', 'style' => 'margin-left: 5px;']);
Modal::end();
Pjax::widget();
$js = <<<JS
\$("#star_container_{$widget->id}").on("pjax:complete", function() {
    \$("#star_container_{$widget->id}").attr("tabindex",-1).focus();
 });
JS;
$this->registerJS($js);
?>

<div id="element_container_<?php 
echo $widget->id;
?>
" class="main-container-element <?php 
echo $widget->main_container_class;
?>
">