From 45b05c75a64da2bdbde7424739364d49b2d955ef Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 25 Jul 2013 11:58:22 +0000 Subject: [PATCH] fix issue with users page git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1506917 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-webapp/src/main/webapp/js/archiva/utils.js | 2 +- .../src/main/webapp/js/knockout-2.3.0.debug.js | 3 ++- .../archiva-webapp/src/main/webapp/js/redback/users.js | 8 +++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/utils.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/utils.js index 6bca0fdbf..7c0db1ce4 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/utils.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/utils.js @@ -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")); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/knockout-2.3.0.debug.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/knockout-2.3.0.debug.js index 1888c274e..61a93db07 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/knockout-2.3.0.debug.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/knockout-2.3.0.debug.js @@ -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); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/users.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/users.js index d3df7fb8e..18c9dafb0 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/users.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/users.js @@ -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);