From cecca877d4df75ecdb0ac5ce8533f10813342a4c Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Sun, 26 Feb 2012 23:08:02 +0000 Subject: [PATCH] use label-warning in delete user modal confirm, add missing i18n git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1293960 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/archiva/i18n/default.properties | 6 ++++++ .../src/main/webapp/js/redback/user.js | 10 ++++------ .../src/main/webapp/js/redback/users.js | 13 ++----------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index 84a3b948c..6289a8d23 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -137,6 +137,12 @@ validated=Validated user.locked=User {0} locked. user.unlocked=User {0} unlocked. user.passwordChangeRequired.updated=Password change required updated for user {0} to {1} +user.created=User {0} created. +user.deleted=User {0} deleted. +user.updated=User {0} updated. +user.admin.created=admin user created +user.details.updated=details updated. +user.delete.message=The following user {0} will be deleted #roles management roles.management.header=Roles Management diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js index 8cc279893..944d83260 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js @@ -102,7 +102,7 @@ $(function() { success: function(result) { var created = JSON.parse(result); if (created == true) { - displaySuccessMessage("user created:"+currentUser.username()); + displaySuccessMessage( $.i18n.prop("user.created",currentUser.username())); if (successFnCallback){ successFnCallback(currentUser); } @@ -137,9 +137,8 @@ $(function() { success: function(result) { var created = JSON.parse(result); if (created == true) { - displaySuccessMessage("admin user created"); + displaySuccessMessage( $.i18n.prop("user.admin.created")); var onSuccessCall=function(){ - $.log("onSuccessCall after admin creation"); reccordLoginCookie(currentAdminUser); screenChange(); checkCreateAdminLink(); @@ -169,6 +168,7 @@ $(function() { success: function(result) { var updated = JSON.parse(result); if (updated == true) { + clearUserMessages(); displaySuccessMessage($.i18n.prop("user.updated",currentUser.username())); $("#main-content #users-view-tabs-li-user-edit a").html($.i18n.prop("add")); clearForm("#main-content #user-create"); @@ -347,10 +347,8 @@ $(function() { logged = true; } } - $.log("successLoginCallbackFn, logged:"+logged); if (logged == true) { var user = mapUser(result.user); - $.log("user.passwordChangeRequired:"+user.passwordChangeRequired()); if (user.passwordChangeRequired()==true){ changePasswordBox(true,false,user); return; @@ -548,7 +546,7 @@ $(function() { var created = JSON.parse(result); // FIXME i18n if (created == true) { - displaySuccessMessage("details updated."); + displaySuccessMessage( $.i18n.prop("user.details.updated")); window.modalEditUserBox.modal('hide'); reccordLoginCookie(user); clearForm("#user-edit-form"); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js index bc0523640..2d581268c 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js @@ -105,7 +105,7 @@ $(function() { dataType: 'json', success: function(data) { // FIXME i18n - displaySuccessMessage("user " + currentUser.username() + " deleted"); + displaySuccessMessage( $.i18n.prop("user.deleted", currentUser.username())); self.users.remove(currentUser); }, error: function(result) { @@ -118,7 +118,7 @@ $(function() { } ); } - ,"Ok", $.i18n.prop("cancel"), $.i18n.prop("user.delete.message") + ": " + currentUser.username(), + ,"Ok", $.i18n.prop("cancel"), $.i18n.prop("user.delete.message", currentUser.username()), $("#user-delete-warning-tmpl" ).tmpl(currentUser)); } @@ -197,7 +197,6 @@ $(function() { return mapApplicationRoles(item); }); viewModel.applicationRoles=ko.observableArray(mappedApplicationRoles); - $.log("applicationRoles length:"+mappedApplicationRoles.length); mainContent.find("#user-edit-roles-edit").attr("data-bind",'template: {name:"user_edit_roles_tmpl"}'); ko.applyBindings(viewModel,mainContent.find("#user-edit-roles-edit").get(0)); $.log("assignedRoles:"+user.assignedRoles().length); @@ -217,13 +216,9 @@ $(function() { } saveUser=function(){ - $.log("UserViewModel#saveUser"); var valid = $("#main-content #user-create").valid(); if (valid==false) { - $.log("user#save valid:false"); return; - } else { - $.log("user#save valid:true,update:"+self.updateMode); } if (self.updateMode==false){ return user.create(function(){self.usersViewModel.users.push(user)}); @@ -292,10 +287,6 @@ $(function() { mainContent.find("#users-view-tabs-li-user-edit").addClass("active"); } - - - - }); -- 2.39.5