lavrentiev/yii2-toastr Simple javascript toast notifications

Yii2 - Javascript Toast Notifications ΒΆ

  1. Установка
  2. ДопустимыС ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹
  3. ДСмонстрация
  4. Π”ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎ

Simple javascript toast notifications - Javascript library for non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be customized and extended.

Latest Stable Version Total Downloads Latest Unstable Version License

Установка ΒΆ

Π Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΠ΅ устанавливаСтся с ΠΏΠΎΠΌΠΎΡ‰ΡŒΡŽ Composer интсрукция ΠΏΠΎ установкС Composer

Установка Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΡ Ρ‡Π΅Ρ€Π΅Π· Composer, Π²Ρ‹ΠΏΠΎΠ»Π½ΠΈΡ‚ΡŒ ΡΠ»Π΅Π΄ΡƒΡŽΡ‰ΡƒΡŽ ΠΊΠΎΠΌΠ°Π½Π΄Ρƒ: composer require --prefer-dist lavrentiev/yii2-toastr ΠΈΠ»ΠΈ (master) composer require --prefer-dist lavrentiev/yii2-toastr "dev-master" ΠΈΠ»ΠΈ внСсти измСнСния Π² ΡΠ΅ΠΊΡ†ΠΈΡŽ require Π² composer.json ΠΈ Π²Ρ‹ΠΏΠΎΠ»Π½ΠΈΡ‚ΡŒ composer update "lavrentiev/yii2-toastr": "^2.0" ΠΈΠ»ΠΈ (master) "lavrentiev/yii2-toastr": "dev-master"

УвСдомлСния Notification::widget() ¢

alt text

use lavrentiev\widgets\toastr\Notification;

Notification::widget([
    'type' => 'info',
    'title' => 'Toast Notifications',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'error',
    'title' => 'Toast Notifications',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'success',
    'title' => 'Toast Notifications',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'warning',
    'title' => 'Toast Notifications',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'info',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'error',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'success',
    'message' => 'Simple javascript toast notifications'
]);

Notification::widget([
    'type' => 'warning',
    'message' => 'Simple javascript toast notifications'
]);

Π’Π°ΠΊΠΆΠ΅ присутствуСт Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ настройки ΠΏΡ€ΠΎΠΈΠ·Π²ΠΎΠ»ΡŒΠ½ΠΎΠ³ΠΎ увСдомлСния, ΠΏΠΎ ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Π°ΠΌ прСдусмотрСнным Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚Ρ‡ΠΈΠΊΠ°ΠΌΠΈ Toastr by CodeSeven

alt text `php Notification::widget([

'type' => Notification::TYPE_ERROR,
'title' => 'Toast Notifications',
'message' => 'Simple javascript toast notifications',
'options' => [
    "closeButton" => false,
    "debug" => false,
    "newestOnTop" => false,
    "progressBar" => false,
    "positionClass" => Notification::POSITION_TOP_RIGHT,
    "preventDuplicates" => false,
    "onclick" => null,
    "showDuration" => "300",
    "hideDuration" => "1000",
    "timeOut" => "5000",
    "extendedTimeOut" => "1000",
    "showEasing" => "swing",
    "hideEasing" => "linear",
    "showMethod" => "fadeIn",
    "hideMethod" => "fadeOut"
]

]); `

УвСдомлСния NotificationFlash::widget() ¢

ΠŸΠΎΠ΄ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠ΅ ΠΎΡΡƒΡ‰Π΅ΡΡ‚Π²Π»ΡΠ΅Ρ‚ΡŒΡΡ глобально допустим Π² layouts ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π°.

<?= \lavrentiev\widgets\toastr\NotificationFlash::widget() ?>

Π’Π°ΠΊΠΆΠ΅ присутствуСт Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ настройки ΡƒΠ²Π΅Π΄ΠΎΠΌΠ»Π΅Π½ΠΈΠΉ, ΠΏΠΎ ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Π°ΠΌ прСдусмотрСнным Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚Ρ‡ΠΈΠΊΠ°ΠΌΠΈ Toastr by CodeSeven

<?= \lavrentiev\widgets\toastr\NotificationFlash::widget([
    'options' => [
        "closeButton" => true,
        "debug" => false,
        "newestOnTop" => false,
        "progressBar" => false,
        "positionClass" => \lavrentiev\widgets\toastr\NotificationFlash::POSITION_TOP_RIGHT,
        "preventDuplicates" => false,
        "onclick" => null,
        "showDuration" => "300",
        "hideDuration" => "1000",
        "timeOut" => "5000",
        "extendedTimeOut" => "1000",
        "showEasing" => "swing",
        "hideEasing" => "linear",
        "showMethod" => "fadeIn",
        "hideMethod" => "fadeOut"
    ]
]) ?>

alt text

\Yii::$app->session->setFlash('error', 'This is the message');
\Yii::$app->session->setFlash('success', 'This is the message');
\Yii::$app->session->setFlash('info', 'This is the message');
\Yii::$app->session->setFlash('warning', 'This is the message');

alt text

\Yii::$app->session->setFlash('warning', ['Error 1', 'Error 2', 'Error 3']);
\Yii::$app->session->setFlash('success', ['Error 1', 'Error 2', 'Error 3']);

ДопустимыС ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ ΒΆ

ΠŸΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Π—Π½Π°Ρ‡Π΅Π½ΠΈΠ΅ ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽΠ”ΠΎΠΏΡƒΡΡ‚ΠΈΠΌΡ‹Π΅ Π·Π½Π°Ρ‡Π΅Π½ΠΈΡΠžΠΏΠΈΡΠ°Π½ΠΈΠ΅
typeinfoinfo, error, success, warningΠ’ΠΈΠΏ увСдомлСния
title------Π—Π°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ увСдомлСния
messageSimple javascript toast notifications---ВСкст увСдомлСния
options[]ΠŸΠΎΠ΄Ρ€ΠΎΠ±Π½Π΅ΠΉ...Π”ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹Π΅ ΠΎΠΏΡ†ΠΈΠΈ

ДопустимыС константы Ρ‚ΠΈΠΏΠΎΠ²: TYPE_INFO = 'info' TYPE_ERROR = 'error' TYPE_SUCCESS = 'success' TYPE_WARNING = 'warning'

ДопустимыС константы полоТСния: ` POSITION_TOP_RIGHT = 'toast-top-right'; POSITION_TOP_LEFT = 'toast-top-left'; POSITION_TOP_CENTER = 'toast-top-center'; POSITION_TOP_FULL_WIDTH = 'toast-top-full-width';

POSITION_BOTTOM_RIGHT = 'toast-bottom-right'; POSITION_BOTTOM_LEFT = 'toast-bottom-left'; POSITION_BOTTOM_CENTER = 'toast-bottom-center'; POSITION_BOTTOM_FULL_WIDTH = 'toast-bottom-full-width'; `

ДСмонстрация ΒΆ

Π”ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎ ΒΆ

0 0
2 followers
104 369 downloads
Yii Version: 2.0
License: BSD-3-Clause
Category: Others
Created on: Apr 13, 2018
Last updated: (not set)
Packagist Profile
Github Repository

Related Extensions