mirror of https://github.com/apache/archiva.git
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:
parent
71da382051
commit
f2fa9085d0
|
@ -159,7 +159,6 @@
|
||||||
window.archivaRuntimeInfo=data;
|
window.archivaRuntimeInfo=data;
|
||||||
|
|
||||||
require(['sammy','archiva.main','domReady!'],function (domReady) {
|
require(['sammy','archiva.main','domReady!'],function (domReady) {
|
||||||
$.log("startArchivaApplication");
|
|
||||||
startArchivaApplication();
|
startArchivaApplication();
|
||||||
$("#loadingDiv").hide();
|
$("#loadingDiv").hide();
|
||||||
})
|
})
|
||||||
|
|
|
@ -65,7 +65,8 @@ function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// by default display search screen
|
// by default display search screen
|
||||||
window.sammyArchivaApplication.setLocation("#search");
|
$.log("location:"+window.sammyArchivaApplication.getLocation());
|
||||||
|
//window.sammyArchivaApplication.setLocation("#search");
|
||||||
}
|
}
|
||||||
|
|
||||||
hasKarma=function(karmaName){
|
hasKarma=function(karmaName){
|
||||||
|
|
|
@ -289,6 +289,8 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.user.createAdmin();
|
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
|
* open a modal box to create admin user
|
||||||
*/
|
*/
|
||||||
adminCreateBox=function() {
|
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue