From 417a6b77b2c996bb7739c636d44230117cd783d7 Mon Sep 17 00:00:00 2001 From: plegall Date: Thu, 28 Jan 2016 12:33:31 +0100 Subject: bug #409 fixed: handle error returned by pwg.users.setInfo --- admin/themes/default/template/user_list.tpl | 32 +++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/admin/themes/default/template/user_list.tpl b/admin/themes/default/template/user_list.tpl index 6744f6f69..54b8b936e 100644 --- a/admin/themes/default/template/user_list.tpl +++ b/admin/themes/default/template/user_list.tpl @@ -259,11 +259,6 @@ jQuery(document).ready(function() { user.lastVisit_string = sprintf(lastVisit_pattern, user.last_visit_string, user.last_visit_since); } - user.updateString = sprintf( - "{/literal}{'User %s updated'|translate|escape:javascript}{literal}", - user.username - ); - user.email = user.email || ''; user.statusLabel = statusLabels[user.status]; @@ -530,8 +525,25 @@ jQuery(document).on('click', '.close-user-details', function(e) { }, success:function(data) { jQuery('#user'+userId+' .submitWait').hide(); - jQuery('#user'+userId+' input[type=submit]').hide(); - jQuery('#user'+userId+' .propertiesUpdateDone').show(); + + var html_message; + + var data = jQuery.parseJSON(data); + if (data.stat == 'ok') { + var message = sprintf( + "{/literal}{'User %s updated'|translate|escape:javascript}{literal}", + data.result.users[0].username + ); + + html_message = '✔ '+message+''; + } + else { + html_message = '✘ '+data.message+''; + } + + jQuery('#user'+userId+' .propertiesUpdateDone') + .html(html_message) + .show(); }, error:function(XMLHttpRequest, textStatus, errorThrows) { jQuery('#user'+userId+' .submitWait').hide(); @@ -1150,11 +1162,13 @@ span.infos, span.errors {background-image:none; padding:2px 5px; margin:0;border
{* userPropertiesContainer *} - - {'close'|translate} + -- cgit v1.2.3