2017 © Pedro Peláez
 

yii2-extension yii2-alert

Yii-Framework widget for Flash Alerts

image

rsol/yii2-alert

Yii-Framework widget for Flash Alerts

  • Sunday, February 28, 2016
  • by RSol
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Yii2-alert

Widget for add PNotify alerts in yii2 application, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist rsol/yii2-alert "*"

or add, (*4)

"rsol/yii2-alert": "*"

to the require section of your composer.json file., (*5)

Usage

in main layout:, (*6)

use rsol\alert\widgets\Alert;
<?= Alert::widget() ?>

you can style your PNotify by, (*7)

<?= Alert::widget([
    'style' => 'bootstrap3',//default
]) ?>

in any place of your code:, (*8)

Yii::$app->session->addFlash('success', Yii::t('users', 'Added social networks connections'));

advanced, (*9)

Yii::$app->session->addFlash('success', [
                    'title' => Yii::t('users', 'Added social networks connections'),
                    'text' => Yii::t('users', 'Are you want to use photo from {soc} as profile photo?', [
                        'soc' => $client->getTitle(),
                    ]),
                    'addclass' => 'alert-styled-left alert-arrow-left text-sky-royal',
                    'hide' => false,
                    'confirm' => [
                        'confirm' => true,
                        'buttons' => [
                            [
                                'text' => Yii::t('users', 'YES'),
                                'addClass' => 'btn-sm',
                            ],
                            [
                                'text' => Yii::t('users', 'NO'),
                                'addClass' => 'btn-sm',
                            ]
                        ]
                    ],
                    'buttons' => [
                        'closer' => false,
                        'sticker' => false,
                    ],
                    'history' => [
                        'history' => false,
                    ],
                    'on' => [
                        'pnotify.confirm' => "function() {
                            $('.cropper').attr('src', '{$attributes['User']['photo']}');
                            $('#modal_large').modal('show');
                        }",
                    ],
                ]);

or JS, (*10)

$swal = [
                    'title' => Yii::t('users', 'Added social networks connections'),
                    'text' => Yii::t('users', 'Are you want to use photo from {soc} as profile photo?', [
                        'soc' => $client->getTitle(),
                    ]),
                    'confirmButtonColor' => "#66BB6A",
                    'type' => "success",
                    'showCancelButton' => true,
                    'confirmButtonText' => Yii::t('users', 'YES'),
                    'cancelButtonText' => Yii::t('users', 'NO'),
                ];
                $ajax = [
                    'url' => Url::toRoute("/user/user/soc-image"),
                    'data' => [
                        'soc' => $filed,
                    ],
                    'success' => new JsExpression('function(data) {
                        if (data.success) {
                            $(".col-lg-3 .eg-preview img.img-circle").attr("src", data.src);
                            $("li.dropdown.dropdown-user a.dropdown-toggle img.img-circle").attr("src", data.src);
                        }
                    }'),
                    'dataType' => "json",
                ];

                Yii::$app->session->addFlash('js', 'swal(' . Json::encode($swal) . ', function(isConfirm){
                    if (isConfirm) {
                        $.ajax(' . Json::encode($ajax) . ');
                    }
                });');

The Versions

28/02 2016

dev-master

9999999-dev

Yii-Framework widget for Flash Alerts

  Sources   Download

BSD-3-Clause

The Requires

 

by Slava Rudnev

extension yii2 alert notify

28/02 2016

1.0.1

1.0.1.0

Yii-Framework widget for Flash Alerts

  Sources   Download

BSD-3-Clause

The Requires

 

by Slava Rudnev

extension yii2 alert notify

28/02 2016

1.0.0

1.0.0.0

Yii-Framework widget for Flash Alerts

  Sources   Download

BSD-3-Clause

The Requires

 

by Slava Rudnev

extension yii2 alert notify