dismissable errors and warnings, fix #1580

This commit is contained in:
Matteo Pagliazzi
2013-10-28 20:16:40 +01:00
parent e0c95b3a86
commit 6ee1b14e97
2 changed files with 10 additions and 2 deletions

View File

@@ -42,6 +42,10 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
alert("This feature is not yet ported from the original site."); alert("This feature is not yet ported from the original site.");
} }
$rootScope.dismissErrorOrWarning = function(type, $index){
$rootScope.flash[type].splice($index, 1);
}
$rootScope.showStripe = function() { $rootScope.showStripe = function() {
StripeCheckout.open({ StripeCheckout.open({
key: window.env.STRIPE_PUB_KEY, key: window.env.STRIPE_PUB_KEY,

View File

@@ -95,8 +95,12 @@ html
#wrap #wrap
// Errors // Errors
.unstyled.alert.alert-error(ng-repeat='error in flash.errors track by $index') {{error}} .unstyled.alert.alert-error(ng-repeat='error in flash.errors track by $index')
.unstyled.alert.alert-error(ng-repeat='error in flash.warnings track by $index') {{error}} | {{error}}
button.close(type='button', ng-click='dismissErrorOrWarning("errors", $index)') ×
.unstyled.alert.alert-error(ng-repeat='error in flash.warnings track by $index')
| {{error}}
button.close(type='button', ng-click='dismissErrorOrWarning("warnings", $index)') ×
//if they hide the header, we still need user-menu visible //if they hide the header, we still need user-menu visible
div(ng-if='user.preferences.hideHeader') div(ng-if='user.preferences.hideHeader')