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:",
"newPassSent": "New password sent.",
"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.",
"error": "Error",
"menu": "Menu",

View File

@@ -35,9 +35,9 @@ angular.module('habitrpg').config(['$httpProvider', function($httpProvider){
// Error
} else {
var error = '<strong>Please reload</strong>, ' +
'"'+window.env.t('error')+' '+(response.data.err || response.data || 'something went wrong')+'" ' +
window.env.t('seeConsole');
var error = window.env.t('requestError') + '<br><br>"' +
window.env.t('error') + ' ' + (response.data.err || response.data || 'something went wrong') +
'" <br><br>' + window.env.t('seeConsole');
if (mobileApp) error = 'Error contacting the server. Please try again in a few minutes.';
$rootScope.$broadcast('responseError', error);
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};
function _notify(html, type, icon) {
console.log(type)
var notice = $.pnotify({
type: type || 'warning', //('info', 'text', 'warning', 'success', 'gp', 'xp', 'hp', 'lvl', 'death', 'mp', 'crit')
text: html,
opacity: 1,
addclass: 'alert-' + type,
delay: 7000,
hide: (type == 'error') ? false : true,
hide: (type == 'error' || type == 'danger') ? false : true,
mouse_reset: false,
width: "250px",
stack: stack_topright,