make error notification persistent, change text and make it translatable

This commit is contained in:
Matteo Pagliazzi
2015-10-28 19:42:26 +01:00
parent 7205ac689d
commit 01373882c6
3 changed files with 6 additions and 4 deletions

View File

@@ -79,6 +79,7 @@
"errorUpCase": "ERROR:", "errorUpCase": "ERROR:",
"newPassSent": "New password sent.", "newPassSent": "New password sent.",
"serverUnreach": "Server currently unreachable.", "serverUnreach": "Server currently unreachable.",
"requestError": "Yikes, an error occurred! <strong>Please reload the page,</strong> your last action may not have been saved correctly.",
"seeConsole": "If the error persists, please report it at Help > Report a Bug. If you're familiar with your browser's console, please include any error messages.", "seeConsole": "If the error persists, please report it at Help > Report a Bug. If you're familiar with your browser's console, please include any error messages.",
"error": "Error", "error": "Error",
"menu": "Menu", "menu": "Menu",

View File

@@ -35,9 +35,9 @@ angular.module('habitrpg').config(['$httpProvider', function($httpProvider){
// Error // Error
} else { } else {
var error = '<strong>Please reload</strong>, ' + var error = window.env.t('requestError') + '<br><br>"' +
'"'+window.env.t('error')+' '+(response.data.err || response.data || 'something went wrong')+'" ' + window.env.t('error') + ' ' + (response.data.err || response.data || 'something went wrong') +
window.env.t('seeConsole'); '" <br><br>' + window.env.t('seeConsole');
if (mobileApp) error = 'Error contacting the server. Please try again in a few minutes.'; if (mobileApp) error = 'Error contacting the server. Please try again in a few minutes.';
$rootScope.$broadcast('responseError', error); $rootScope.$broadcast('responseError', error);
console.error(response); console.error(response);

View File

@@ -108,13 +108,14 @@ angular.module("habitrpg").factory("Notification",
var stack_topright = {"dir1": "down", "dir2": "left", "spacing1": 15, "spacing2": 15, "firstpos1": 60}; var stack_topright = {"dir1": "down", "dir2": "left", "spacing1": 15, "spacing2": 15, "firstpos1": 60};
function _notify(html, type, icon) { function _notify(html, type, icon) {
console.log(type)
var notice = $.pnotify({ var notice = $.pnotify({
type: type || 'warning', //('info', 'text', 'warning', 'success', 'gp', 'xp', 'hp', 'lvl', 'death', 'mp', 'crit') type: type || 'warning', //('info', 'text', 'warning', 'success', 'gp', 'xp', 'hp', 'lvl', 'death', 'mp', 'crit')
text: html, text: html,
opacity: 1, opacity: 1,
addclass: 'alert-' + type, addclass: 'alert-' + type,
delay: 7000, delay: 7000,
hide: (type == 'error') ? false : true, hide: (type == 'error' || type == 'danger') ? false : true,
mouse_reset: false, mouse_reset: false,
width: "250px", width: "250px",
stack: stack_topright, stack: stack_topright,