Don't try to use the template engine's gettext on Javascript variables, as it won't work as the templates are evaluated before any JS is executed.

This commit is contained in:
Neel Patel 2016-04-18 08:39:25 -04:00 committed by Dave Page
parent 4f8b018b39
commit 37699a9820
3 changed files with 17 additions and 8 deletions

View File

@ -211,8 +211,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
try { try {
var err = $.parseJSON(xhr.responseText); var err = $.parseJSON(xhr.responseText);
if (err.success == 0) { if (err.success == 0) {
msg = S('{{ _(' + err.errormsg + ')}}').value(); alertify.error(err.errormsg);
alertify.error("{{ _('" + err.errormsg + "') }}");
} }
} catch (e) {} } catch (e) {}
} }

View File

@ -151,13 +151,18 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
t.unload(i); t.unload(i);
t.setInode(i); t.setInode(i);
} }
else {
try {
Alertify.error(res.errormsg);
} catch (e) {}
t.unload(i);
}
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
try { try {
var err = $.parseJSON(xhr.responseText); var err = $.parseJSON(xhr.responseText);
if (err.success == 0) { if (err.success == 0) {
msg = S('{{ _(' + err.errormsg + ')}}').value(); Alertify.error(err.errormsg);
Alertify.error("{{ _('" + err.errormsg + "') }}");
} }
} catch (e) {} } catch (e) {}
t.unload(i); t.unload(i);

View File

@ -87,7 +87,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
type:'DELETE', type:'DELETE',
success: function(res) { success: function(res) {
if (res.success == 1) { if (res.success == 1) {
alertify.success("{{ _('" + res.info + "') }}"); alertify.success(res.info);
d = t.itemData(i); d = t.itemData(i);
t.removeIcon(i); t.removeIcon(i);
d.connected = false; d.connected = false;
@ -99,13 +99,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
} }
obj.trigger('server-disconnected', obj, i, d); obj.trigger('server-disconnected', obj, i, d);
} }
else {
try {
alertify.error(res.errormsg);
} catch (e) {}
t.unload(i);
}
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
try { try {
var err = $.parseJSON(xhr.responseText); var err = $.parseJSON(xhr.responseText);
if (err.success == 0) { if (err.success == 0) {
msg = S('{{ _(' + err.errormsg + ')}}').value(); alertify.error(err.errormsg);
alertify.error("{{ _('" + err.errormsg + "') }}");
} }
} catch (e) {} } catch (e) {}
t.unload(i); t.unload(i);