Coder Social home page Coder Social logo

yii-noty's Introduction

yii-noty

Yii widget for Noty jQuery notification plugin, Visit Noty

For Yii2: Please check yii2-noty

Installation:

Download the zip file and unzip it in your project extension folder webroot/protected/extensions/ and rename yii-noty-master to yii-noty

Usage Details:

Add the widget in your main layout file like below,

<?php
$this->widget('ext.yii-noty.ENotificationWidget', array(
    'options' => array( // you can add js options here, see noty plugin page for available options
      'dismissQueue' => true,
      'layout' => 'topCenter',
      'theme' => 'relax',
      'animation' => array(
      'open' => 'animated flipInX',
      'close' => 'animated flipOutX',
      'easing' => 'swing',
      'speed ' => 500,
    ),
    'timeout' => 6000,
  ),
  'enableIcon' => true,
  'enableFontAwesomeCss' => true,
));
?>

This widget will create a JS function generateAlert(), so it will be available globally and you can call this function in your custom JS codes. See the following example, after you delete a record from your grid show deleted successful message like below,

'afterDelete' => 'function(link,success,data) {
  if (success) {
    var flash = generateAlert();
    
    $.noty.setText(flash.options.id, "<i class=\"fa fa-check-circle\"></i> <strong>Success!</strong> Deleted successfully.");
    $.noty.setType(flash.options.id, "success");
  }
}',

You can set the flash messages like this in your controller or anywhere you need,

Yii::app()->user->setFlash('type', 'Message here');

Replace type with available types

Available Types:

  • success
  • error
  • warning
  • information
  • alert

yii-noty's People

Contributors

shifrin avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.