fix issue with users page

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1506917 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-07-25 11:58:22 +00:00
parent 29850b7e49
commit 45b05c75a6
3 changed files with 8 additions and 5 deletions

View File

@ -128,7 +128,7 @@ require(["jquery","jquery.tmpl","i18n","knockout"], function(jquery,jqueryTmpl,i
var mainContent=$("#main-content");
mainContent.empty();
mainContent.removeAttr("data-bind");
$("#body_content" ).find(".popover" ).hide();
$("#body_content").find(".popover" ).hide();
clearUserMessages();
if(window.archivaModel.adminExists==false){
displayErrorMessage($.i18n.prop("admin.creation.mandatory"));

View File

@ -2099,7 +2099,8 @@ ko.exportSymbol('bindingProvider', ko.bindingProvider);
var alreadyBound = ko.utils.domData.get(node, boundElementDomDataKey);
if (!bindings) {
if (alreadyBound) {
throw Error("You cannot apply bindings multiple times to the same element.");
// prevent issue with #users
//throw Error("You cannot apply bindings multiple times to the same element.");
}
ko.utils.domData.set(node, boundElementDomDataKey, true);
}

View File

@ -315,7 +315,7 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
screenChange();
var mainContent = $("#main-content");
mainContent.html(mediumSpinnerImg());
mainContent.attr("data-bind",'template: {name:"usersGrid"}');
$.ajax("restServices/redbackServices/userService/getUsers", {
type: "GET",
@ -327,7 +327,10 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
var usersViewModel = new UsersViewModel();
usersViewModel.users(mappedUsers);
usersViewModel.originalUsers(mappedUsers);
ko.applyBindings(usersViewModel,jQuery("#main-content").get(0));
mainContent.attr("data-bind",'template: {name:"usersGrid"}');
$.log("before applyBindings");
ko.applyBindings(usersViewModel,mainContent.get(0));//mainContent.find("#usersTable" ).get(0));//
$.log("first applyBindings");
mainContent.find("#users-view-tabs a:first").tab('show');
mainContent.find("#users-view-tabs a[data-toggle='tab']").on('show', function (e) {
if ($(e.target).attr("href")=="#createUserForm") {
@ -336,7 +339,6 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
if ($(e.target).attr("href")=="#users-view") {
mainContent.find("#users-view-tabs-li-user-edit a").html($.i18n.prop("add"));
}
})
mainContent.find("#users-view-tabs-content #users-view").addClass("active");
applyAutocompleteOnHeaders(usersViewModel);