-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
102 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* @link http://www.yiiframework.com/ | ||
* @copyright Copyright (c) 2008 Yii Software LLC | ||
* @license http://www.yiiframework.com/license/ | ||
*/ | ||
|
||
namespace stronglab\alert; | ||
|
||
use yii\web\AssetBundle; | ||
|
||
class AlertAsset extends AssetBundle | ||
{ | ||
public $sourcePath = '@stronglab/alert/web'; | ||
public $css = [ | ||
'alert.css', | ||
]; | ||
public $js = [ | ||
'alert.js', | ||
]; | ||
|
||
public $depends = [ | ||
'yii\web\JqueryAsset', | ||
'yii\bootstrap\BootstrapAsset', | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
{ | ||
"name": "stronglab/yii2-alert", | ||
"description": "Yii2 Alert Message", | ||
"type": "yii2-extension", | ||
"keywords": ["yii2","extension"], | ||
"license": "BSD-3-Clause", | ||
"authors": [ | ||
{ | ||
"name": "strong", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"yiisoft/yii2": "*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"stronglab\\alert\\": "" | ||
} | ||
"name": "stronglab/yii2-alert", | ||
"description": "Yii2 Alert Message", | ||
"type": "yii2-extension", | ||
"keywords": [ | ||
"yii2", | ||
"extension" | ||
], | ||
"license": "BSD-3-Clause", | ||
"authors": [ | ||
{ | ||
"name": "strong", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"yiisoft/yii2": "*", | ||
"yiisoft/yii2-bootstrap": "*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"stronglab\\alert\\": "" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.flash-modal { | ||
position: fixed; | ||
top: 20px; | ||
right: 30px; | ||
z-index: 9999; | ||
display: none; | ||
width: 350px; | ||
padding: 30px; | ||
text-align: center; | ||
border-radius: 4px; | ||
border: 1px #9acfea solid; | ||
font-size: 1.1em; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
$(".flash-modal").bind("contextmenu", function (e) { | ||
e.preventDefault(); | ||
$(this).fadeOut(420); | ||
}); | ||
|
||
function showMessage(message, fade, type) { | ||
fade = typeof fade !== "undefined" ? fade : 1; | ||
type = typeof type !== "undefined" ? type : "alert-info"; | ||
var obj = $(".flash-modal"); | ||
obj.html("<b>" + message + "</b>"); | ||
obj.addClass(type); | ||
obj.stop().animate({opacity: "100"}); | ||
obj.show(); | ||
if (fade) { | ||
messageBoxFadeOut(); | ||
obj.mouseover( | ||
function () { | ||
if ($(this).is(":animated")) { | ||
$(this).stop().animate({opacity: "100"}); | ||
} | ||
} | ||
); | ||
obj.mouseleave(messageBoxFadeOut); | ||
|
||
} | ||
} | ||
|
||
function messageBoxFadeOut() { | ||
var obj = $(".flash-modal"); | ||
obj.fadeOut(7000, function () { | ||
obj.removeClass("alert-danger alert-success alert-info"); | ||
}); | ||
} |