do not display admin createbox if admin already created

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1360439 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-07-11 22:03:29 +00:00
parent 71da382051
commit f2fa9085d0
3 changed files with 36 additions and 18 deletions

View File

@ -159,7 +159,6 @@
window.archivaRuntimeInfo=data;
require(['sammy','archiva.main','domReady!'],function (domReady) {
$.log("startArchivaApplication");
startArchivaApplication();
$("#loadingDiv").hide();
})

View File

@ -65,7 +65,8 @@ function() {
return;
}
// by default display search screen
window.sammyArchivaApplication.setLocation("#search");
$.log("location:"+window.sammyArchivaApplication.getLocation());
//window.sammyArchivaApplication.setLocation("#search");
}
hasKarma=function(karmaName){

View File

@ -289,6 +289,8 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
return;
}
self.user.createAdmin();
// go to search when admin created
window.sammyArchivaApplication.setLocation("#search");
}
}
@ -296,24 +298,40 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
* open a modal box to create admin user
*/
adminCreateBox=function() {
$.log("adminCreateBox");
window.redbackModel.createUser=true;
$("#main-content").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
var viewModel = new AdminUserViewModel();
ko.applyBindings(viewModel,$("#main-content" ).get(0));
$("#user-create").validate({
rules: {
confirmPassword: {
equalTo: "#password"
}
},
showErrors: function(validator, errorMap, errorList) {
customShowError("#main-content #user-create",validator,errorMap,errorMap);
}
$.ajax("restServices/redbackServices/userService/isAdminUserExists", {
type: "GET",
dataType: 'json',
success: function(data) {
var adminExists = data;
if (adminExists == false) {
window.redbackModel.createUser=true;
$("#main-content").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
var viewModel = new AdminUserViewModel();
ko.applyBindings(viewModel,$("#main-content" ).get(0));
$.log("adminCreateBox");
$("#user-create").validate({
rules: {
confirmPassword: {
equalTo: "#password"
}
},
showErrors: function(validator, errorMap, errorList) {
customShowError("#main-content #user-create",validator,errorMap,errorMap);
}
});
// desactivate roles pill when adding user
$("#edit_user_details_pills_headers").hide();
} else {
window.sammyArchivaApplication.setLocation("#search");
}
}
});
// desactivate roles pill when adding user
$("#edit_user_details_pills_headers").hide();
}
/**