-
Notifications
You must be signed in to change notification settings - Fork 27
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
0 parents
commit 7c1617c
Showing
9 changed files
with
734 additions
and
0 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,7 @@ | ||
node_modules | ||
components | ||
bower_components | ||
|
||
# IntelliJ | ||
.idea/ | ||
*.iml |
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,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2013 Salakar | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,118 @@ | ||
Angular Toasty | ||
================= | ||
|
||
**Angular Toasty** is a angularjs module that provides growl-style alerts and messages for your angular app with extensive features. | ||
|
||
Latest release requires AngularJS v1.2.6 or higher and angular-animate for the CSS3 transformations. | ||
|
||
This module is based on **AngularJS-Toaster** by Jirikavi. | ||
|
||
|
||
#### Current Version 0.1.1 | ||
 | ||
|
||
#### Current Features | ||
* onClick, onAdd, onRemove event handlers. | ||
* show / hide close button. (showClose) | ||
* enable / disable click to close. (clickToClose) | ||
* success, wait, info, warning & error toast types. | ||
* adjust timeouts. | ||
* toast sounds | ||
* toast position. (bottom-right as default) | ||
* toast add to top/bottom of current toasts. | ||
|
||
#### Planned Features | ||
* Toast shaking via css. | ||
* Toast sizes. | ||
* Toggle toast sounds. | ||
|
||
I've yet to do the documentation, so please see sample app for several usage examples. | ||
|
||
#### Example controller using Toasty: | ||
JS: | ||
```javascript | ||
angular.module('main', ['ngAnimate', 'toasty']) | ||
.controller('myController', function($scope, toasty, $timeout, $window) { | ||
|
||
$scope.pop = function() { | ||
toasty.pop.success({ | ||
title: "Success", | ||
msg: 'User [email protected] added!', | ||
timeout: 10000, | ||
showClose: false, | ||
myData: 'Testing 1 2 3', // you can add any objects as extras | ||
onClick: function(toasty) { | ||
console.log(toasty.myData); | ||
toasty.msg = 'I updated myself'; | ||
toasty.title = 'A new title!'; | ||
//toasty.remove(); | ||
//toasty.removeAll(); | ||
}, | ||
onAdd: function(toasty) { | ||
console.log(toasty.id + ' has been added!'); | ||
}, | ||
onRemove: function(toasty) { | ||
console.log(toasty.id + ' has been removed!'); | ||
} | ||
}); | ||
|
||
toasty.pop.warning({ | ||
title: 'Warning', | ||
msg: 'No users found.', | ||
clickToClose: true | ||
}); | ||
|
||
toasty.pop.wait({ | ||
title: 'Please Wait', | ||
msg: 'Loading users...', | ||
timeout: 0, | ||
clickToClose: false, | ||
showClose: false, | ||
onAdd: function(toasty) { | ||
console.log(toasty.id + ' has been added!'); | ||
|
||
// after 5 secs changes to success | ||
var doSuccess = function() { | ||
toasty.title = 'Success'; | ||
toasty.msg = 'Finished loading users.'; | ||
//toasty.type = 'toasty-success'; | ||
} | ||
$timeout(doSuccess, 5000); | ||
}, | ||
}); | ||
|
||
toasty.pop.error({ | ||
title: 'Error', | ||
msg: 'Failed to delete user.', | ||
clickToClose: true | ||
}); | ||
|
||
toasty.pop.info({ | ||
title: 'Info', | ||
msg: 'Welcome...', | ||
clickToClose: true | ||
}); | ||
|
||
}; | ||
|
||
$scope.clear = function() { | ||
toasty.clear() | ||
}; | ||
|
||
}); | ||
``` | ||
HTML: | ||
```HTML | ||
<div ng-controller="myController"> | ||
<div> | ||
<button class="btn btn-primary" style="margin: 150px 0 0 150px;" ng-click="pop()">Show toasts</button> | ||
<br /> | ||
<button class="btn btn-danger" style="margin: 10px 0 0 150px;" ng-click="clear()">Clear toasts</button> | ||
</div> | ||
</div> | ||
|
||
<!-- Toasty controller, add this to your index page / default template --> | ||
<div ng-controller="toasty-controller"> | ||
<toasty-container toasty-defaults='{"timeout": 3000, "close-button":true}'></toasty-container> | ||
</div> | ||
``` |
Binary file not shown.
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,18 @@ | ||
{ | ||
"name": "angular-toasty", | ||
"version": "0.1.1", | ||
"main": [ | ||
"js/ng-toasty.js", | ||
"css/ng-toasty.css", | ||
"audio/toasty.wav" | ||
], | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"components" | ||
], | ||
"dependencies": { | ||
"angular": ">1.2.6", | ||
"angular-animate": "~1.2.8" | ||
} | ||
} |
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,221 @@ | ||
/* | ||
* Toasty | ||
* Version 0.1.2 | ||
*/ | ||
.toasty-title { | ||
padding:2px; | ||
margin-top: 12px; | ||
padding-left: 5px; | ||
font-weight: bold; | ||
font-size: 14px; | ||
color: white; | ||
line-height: 18px; | ||
} | ||
.toasty-message { | ||
-ms-word-wrap: break-word; | ||
word-wrap: break-word; | ||
padding-left: 5px; | ||
color: white; | ||
height: 56px; | ||
font-size: 11px; | ||
} | ||
.toasty-message a, | ||
.toasty-message label { | ||
color: #ffffff; | ||
} | ||
.toasty-message a:hover { | ||
color: #cccccc; | ||
text-decoration: none; | ||
} | ||
|
||
.toasty-close-button { | ||
position: relative; | ||
right: 0.2em; | ||
top: -0.1em; | ||
float: right; | ||
font-size: 20px; | ||
font-weight: bold; | ||
color: #ffffff; | ||
-webkit-text-shadow: 0 1px 0 #ffffff; | ||
text-shadow: 0 1px 0 #ffffff; | ||
opacity: 0.8; | ||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); | ||
filter: alpha(opacity=80); | ||
} | ||
.toasty-close-button:hover, | ||
.toasty-close-button:focus { | ||
color: #000000; | ||
text-decoration: none; | ||
cursor: pointer; | ||
opacity: 0.4; | ||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); | ||
filter: alpha(opacity=40); | ||
} | ||
|
||
/*Additional properties for button version | ||
iOS requires the button element instead of an anchor tag. | ||
If you want the anchor version, it requires `href="#"`.*/ | ||
button.toasty-close-button { | ||
padding: 0; | ||
cursor: pointer; | ||
background: transparent; | ||
border: 0; | ||
-webkit-appearance: none; | ||
} | ||
.toasty-top-full-width { | ||
top: 0; | ||
right: 0; | ||
width: 100%; | ||
} | ||
.toasty-bottom-full-width { | ||
bottom: 0; | ||
right: 0; | ||
width: 100%; | ||
} | ||
.toasty-top-left { | ||
top: 12px; | ||
left: 12px; | ||
} | ||
.toasty-top-right { | ||
top: 12px; | ||
right: 12px; | ||
} | ||
.toasty-bottom-right { | ||
right: 12px; | ||
bottom: 12px; | ||
} | ||
.toasty-bottom-left { | ||
bottom: 12px; | ||
left: 12px; | ||
} | ||
|
||
|
||
|
||
#toasty-container { | ||
position: fixed; | ||
z-index: 999999; | ||
/*overrides*/ | ||
|
||
} | ||
#toasty-container * { | ||
-moz-box-sizing: border-box; | ||
-webkit-box-sizing: border-box; | ||
box-sizing: border-box; | ||
} | ||
#toasty-container > div { | ||
margin: 0 0 6px; | ||
padding: 0; | ||
width: 285px; | ||
height: 65px; | ||
padding-left: 65px; | ||
border:1px solid lightgrey; | ||
background-position: 22px center; | ||
background-repeat: no-repeat; | ||
-webkit-box-shadow: rgba(0, 0, 0, 0.258824) 0px 2px 5px 0px; | ||
border-bottom-left-radius: 2px; | ||
border-bottom-right-radius: 2px; | ||
border-top-left-radius: 2px; | ||
border-top-right-radius: 2px; | ||
box-shadow: rgba(0, 0, 0, 0.258824) 0px | ||
opacity: 0.8; | ||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); | ||
filter: alpha(opacity=80); | ||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif !important; | ||
} | ||
#toasty-container > :hover { | ||
|
||
opacity: 1; | ||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); | ||
filter: alpha(opacity=100); | ||
cursor: pointer; | ||
} | ||
#toasty-container > .toasty-info { | ||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=") !important; | ||
} | ||
#toasty-container > .toasty-wait { | ||
background-image: url("data:image/gif;base64,R0lGODlhIAAgAPMAAEKLyv///2uk1ZzC4ner2Iy43tbl8r7X7F6c0VWWz3Ko1+fw9/v8/QAAAAAAAAAAACH+GkNyZWF0ZWQgd2l0aCBhamF4bG9hZC5pbmZvACH5BAAKAAAAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAIAAgAAAE5xDISWlhperN52JLhSSdRgwVo1ICQZRUsiwHpTJT4iowNS8vyW2icCF6k8HMMBkCEDskxTBDAZwuAkkqIfxIQyhBQBFvAQSDITM5VDW6XNE4KagNh6Bgwe60smQUB3d4Rz1ZBApnFASDd0hihh12BkE9kjAJVlycXIg7CQIFA6SlnJ87paqbSKiKoqusnbMdmDC2tXQlkUhziYtyWTxIfy6BE8WJt5YJvpJivxNaGmLHT0VnOgSYf0dZXS7APdpB309RnHOG5gDqXGLDaC457D1zZ/V/nmOM82XiHRLYKhKP1oZmADdEAAAh+QQACgABACwAAAAAIAAgAAAE6hDISWlZpOrNp1lGNRSdRpDUolIGw5RUYhhHukqFu8DsrEyqnWThGvAmhVlteBvojpTDDBUEIFwMFBRAmBkSgOrBF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9VCNkDWUhGkuE5PxJNwiUK4UfLzOlD4WvzAHaoG9nxPi5d+jYUqfAhhykOFwJWiAAAIfkEAAoACwAsAAAAACAAIAAABPAQyElpUqnqzaciSoVkXVUMFaFSwlpOCcMYlErAavhOMnNLNo8KsZsMZItJEIDIFSkLGQoQTNhIsFehRww2CQLKF0tYGKYSg+ygsZIuNqJksKgbfgIGepNo2cIUB3V1B3IvNiBYNQaDSTtfhhx0CwVPI0UJe0+bm4g5VgcGoqOcnjmjqDSdnhgEoamcsZuXO1aWQy8KAwOAuTYYGwi7w5h+Kr0SJ8MFihpNbx+4Erq7BYBuzsdiH1jCAzoSfl0rVirNbRXlBBlLX+BP0XJLAPGzTkAuAOqb0WT5AH7OcdCm5B8TgRwSRKIHQtaLCwg1RAAAOwAAAAAAAAAAAA==") !important; | ||
} | ||
#toasty-container > .toasty-error { | ||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=") !important; | ||
} | ||
#toasty-container > .toasty-success { | ||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==") !important; | ||
} | ||
#toasty-container > .toasty-warning { | ||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=") !important; | ||
} | ||
#toasty-container.toasty-top-full-width > div, | ||
#toasty-container.toasty-bottom-full-width > div { | ||
width: 96%; | ||
margin: auto; | ||
} | ||
.toasty { | ||
background-color: #78909c; | ||
} | ||
.toasty-success { | ||
background-color: #5cb85c; | ||
} | ||
.toasty-error { | ||
background-color: #d9534f; | ||
} | ||
.toasty-info { | ||
background-color: #5bc0de; | ||
} | ||
.toasty-wait { | ||
background-color: #428bca; | ||
} | ||
.toasty-warning { | ||
background-color: #f0ad4e; | ||
} | ||
/*Responsive Design*/ | ||
@media all and (max-width: 240px) { | ||
#toasty-container > div { | ||
padding: 8px 8px 8px 50px; | ||
width: 11em; | ||
} | ||
#toasty-container .toasty-close-button { | ||
right: -0.5em; | ||
top: -0.9em; | ||
} | ||
} | ||
@media all and (min-width: 241px) and (max-width: 480px) { | ||
#toasty-container > div { | ||
|
||
width: 18em; | ||
} | ||
#toasty-container .toasty-close-button { | ||
right: -0.5em; | ||
top: -0.9em; | ||
} | ||
} | ||
@media all and (min-width: 481px) and (max-width: 768px) { | ||
#toasty-container > div { | ||
|
||
width: 25em; | ||
} | ||
} | ||
|
||
/* | ||
* AngularJS-Toaster | ||
* Version 0.3 | ||
*/ | ||
#toasty-container > div.ng-enter, | ||
#toasty-container > div.ng-leave | ||
{ | ||
-webkit-transition: 550ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; | ||
-moz-transition: 550ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; | ||
-ms-transition: 550ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; | ||
-o-transition: 550ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; | ||
transition: 550ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; | ||
} | ||
|
||
#toasty-container > div.ng-enter.ng-enter-active, | ||
#toasty-container > div.ng-leave { | ||
opacity: 0.8; | ||
} | ||
|
||
#toasty-container > div.ng-leave.ng-leave-active, | ||
#toasty-container > div.ng-enter { | ||
opacity: 0; | ||
} |
Oops, something went wrong.