]> source.dussan.org Git - archiva.git/commitdiff
some jquery selector optims
authorOlivier Lamy <olamy@apache.org>
Fri, 24 Aug 2012 13:37:20 +0000 (13:37 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 24 Aug 2012 13:37:20 +0000 (13:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1376908 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/network-proxies.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repositories.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/roles.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js

index 0bf6e12cbad602cafa3773e693ff105857804a90..1c7239c1e2d854318e69316d98c7f0f5f2a7572d 100644 (file)
@@ -61,7 +61,7 @@ define("archiva.network-proxies",["jquery","i18n","jquery.tmpl","bootstrap","jqu
     this.bulkMode=false || bulkMode;
 
     this.save=function(){
-      if (!$("#main-content #network-proxy-edit-form").valid()){
+      if (!$("#main-content" ).find("#network-proxy-edit-form").valid()){
         return;
       }
       if (!this.bulkMode){
@@ -215,12 +215,12 @@ define("archiva.network-proxies",["jquery","i18n","jquery.tmpl","bootstrap","jqu
         mainContent.find("#network-proxies-view-tabs").on('show', function (e) {
           if ($(e.target).attr("href")=="#network-proxies-edit") {
             var viewModel = new NetworkProxyViewModel(new NetworkProxy(),false,networkProxiesViewModel);
-            ko.applyBindings(viewModel,$("#main-content #network-proxies-edit").get(0));
+            ko.applyBindings(viewModel,$("#main-content" ).find("#network-proxies-edit").get(0));
             activateNetworkProxyFormValidation();
             clearUserMessages();
           }
           if ($(e.target).attr("href")=="#network-proxies-view") {
-            $("#main-content #network-proxies-view-tabs-li-edit a").html($.i18n.prop("add"));
+            $("#main-content" ).find("#network-proxies-view-tabs-li-edit a").html($.i18n.prop("add"));
             clearUserMessages();
           }
 
@@ -252,10 +252,10 @@ define("archiva.network-proxies",["jquery","i18n","jquery.tmpl","bootstrap","jqu
           ],
           pageSize: 5,
           gridUpdateCallBack: function(networkProxy){
-            $("#main-content #networkProxiesTable [title]").tooltip();
+            $("#main-content" ).find("#networkProxiesTable [title]").tooltip();
           }
         });
-        ko.applyBindings(networkProxiesViewModel,$("#main-content #network-proxies-view").get(0));
+        ko.applyBindings(networkProxiesViewModel,$("#main-content" ).find("#network-proxies-view").get(0));
       }
     )
   }
@@ -270,7 +270,7 @@ define("archiva.network-proxies",["jquery","i18n","jquery.tmpl","bootstrap","jqu
   }
 
   activateNetworkProxyFormValidation=function(){
-    var editForm=$("#main-content #network-proxy-edit-form");
+    var editForm=$("#main-content" ).find("#network-proxy-edit-form");
     var validator = editForm.validate({
       rules: {id: {
        required: true,
index d897a34ffad9a5e19e8ab5274dd45ea3d18a22ea..65177c55fb3db7cceca8d14550486eca6505aa43 100644 (file)
@@ -150,7 +150,7 @@ define("archiva.proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jq
     }
 
     changePolicyOption=function(id){
-      var selectedOption=$("#main-content #policy-"+id + " option:selected");
+      var selectedOption=$("#main-content").find("#policy-"+id ).find("option:selected");
       if (selectedOption.length>0){
         var value = selectedOption.val();
         $.log("changePolicyOption:"+id+":"+value);
@@ -172,7 +172,7 @@ define("archiva.proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jq
 
 
     addBlacklistPattern=function(){
-      var pattern = $("#main-content #blacklist-value").val();
+      var pattern = $("#main-content").find("#blacklist-value").val();
       var tab =  self.proxyConnector.blackListPatterns();
       tab.push(pattern);
       self.proxyConnector.blackListPatterns(tab);
@@ -185,7 +185,7 @@ define("archiva.proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jq
     }
 
     addWhitelistPattern=function(){
-      var pattern = $("#main-content #whitelist-value").val();
+      var pattern = $("#main-content" ).find("#whitelist-value").val();
       var tab =  self.proxyConnector.whiteListPatterns();
       tab.push(pattern);
       self.proxyConnector.whiteListPatterns(tab);
@@ -430,7 +430,7 @@ define("archiva.proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jq
 
       var managedRepository = getManagedRepository(proxyConnector.sourceRepoId());
       var proxyConnectorEditOrderViewModel=new ProxyConnectorEditOrderViewModel(proxyConnectors,self,managedRepository);
-      ko.applyBindings(proxyConnectorEditOrderViewModel,$("#main-content #proxy-connector-edit-order").get(0));
+      ko.applyBindings(proxyConnectorEditOrderViewModel,$("#main-content").find("#proxy-connector-edit-order").get(0));
       activateProxyConnectorsEditOrderTab();
     }
 
@@ -439,7 +439,7 @@ define("archiva.proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jq
         data: self.proxyConnectors,
         pageSize: 5,
         gridUpdateCallBack: function(){
-          $("#main-content #proxyConnectorsTable [title]").tooltip();
+          $("#main-content" ).find("#proxyConnectorsTable" ).find("[title]").tooltip();
         }
       });
       var mainContent = $("#main-content");
index 97576bc516077c9fac149616f57a4e4f6a2d4d0a..9df4a6da6ec8ffb81edbd59647229b442727aa31 100644 (file)
@@ -178,7 +178,7 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
     this.availableLayouts = window.managedRepositoryTypes;
 
     this.save=function(){
-      var valid = $("#main-content #managed-repository-edit-form").valid();
+      var valid = $("#main-content").find("#managed-repository-edit-form").valid();
       if (valid==false) {
           return;
       }
@@ -261,7 +261,7 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
   }
 
   activateManagedRepositoryFormValidation=function(){
-    var validator = $("#main-content #managed-repository-edit-form").validate({
+    var validator = $("#main-content" ).find("#managed-repository-edit-form").validate({
       rules: {
         daysOlder : {
           digits: true,
@@ -314,7 +314,7 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
       clearUserMessages();
       openDialogConfirm(
           function(){
-            $("#dialog-confirm-modal #modal-login-footer").append(smallSpinnerImg());
+            $("#dialog-confirm-modal" ).find("#modal-login-footer").append(smallSpinnerImg());
             var checked = $("#managed-repository-scan-now-all").get(0).checked;
             var url = "restServices/archivaServices/repositoriesService/scanRepositoryNow?";
             url += "repositoryId="+encodeURIComponent(managedRepository.id());
@@ -351,7 +351,7 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
       clearUserMessages();
       openDialogConfirm(
           function(){
-            $("#dialog-confirm-modal #modal-login-footer").append(smallSpinnerImg());
+            $("#dialog-confirm-modal").find("#modal-login-footer").append(smallSpinnerImg());
             var url = "restServices/archivaServices/managedRepositoriesService/deleteManagedRepository?";
             url += "repositoryId="+encodeURIComponent(managedRepository.id());
 
@@ -645,7 +645,7 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
     this.availableLayouts = window.managedRepositoryTypes;
 
     this.save=function(){
-      var valid = $("#main-content #remote-repository-edit-form").valid();
+      var valid = $("#main-content" ).find("#remote-repository-edit-form").valid();
       if (valid==false) {
         return;
       }
@@ -815,7 +815,7 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
 
   activateRemoteRepositoryFormValidation=function(){
     // FIXME find a way to activate cronExpression validation only if downloadRemote is activated !
-    var validator = $("#main-content #remote-repository-edit-form").validate({
+    var validator = $("#main-content" ).find("#remote-repository-edit-form").validate({
       rules: {
         id: {
           required: true,
@@ -891,7 +891,7 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
         ],
         pageSize: 5,
         gridUpdateCallBack: function(){
-          $("#main-content #managed-repositories-table").find("[title]").tooltip();
+          $("#main-content" ).find("#managed-repositories-table").find("[title]").tooltip();
         }
       });
       var mainContent = $("#main-content");
@@ -928,7 +928,7 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
         ],
         pageSize: 5,
         gridUpdateCallBack: function(){
-          $("#main-content #remote-repositories-table").find("[title]").tooltip();
+          $("#main-content" ).find("#remote-repositories-table").find("[title]").tooltip();
         }
       });
       var mainContent = $("#main-content");
@@ -960,13 +960,13 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
             success: function(data) {
               var viewModel = new RemoteRepositoryViewModel(new RemoteRepository(),false,remoteRepositoriesViewModel);
               viewModel.networkProxies(mapNetworkProxies(data));
-              ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0));
+              ko.applyBindings(viewModel,$("#main-content" ).find("#remote-repository-edit").get(0));
               activateRemoteRepositoryFormValidation();
             }
         })
       }
       if ($(e.target).attr("href")=="#remote-repositories-view") {
-        $("#main-content #remote-repository-edit-li a").html($.i18n.prop("add"));
+        $("#main-content" ).find("#remote-repository-edit-li" ).find("a").html($.i18n.prop("add"));
       }
 
     });
index feb1510c34b358b5068648abe16c272166c9f4c8..9744d4f4d401fc76d4c89a2f5763c63850608acf 100644 (file)
@@ -111,8 +111,8 @@ function() {
       $.log("editRepositoryGroup:"+repositoryGroup.id()+",repositories:"+repositoryGroup.repositories().length+",managed:"+repositoryGroup.managedRepositories().length);
       var repositoryGroupViewModel=new RepositoryGroupViewModel(repositoryGroup,true,self);
       activateRepositoryGroupEditTab();
-      ko.applyBindings(repositoryGroupViewModel,$("#main-content #repository-groups-edit" ).get(0));
-      $("#main-content #repository-groups-view-tabs-li-edit a").html($.i18n.prop("edit"));
+      ko.applyBindings(repositoryGroupViewModel,$("#main-content").find("#repository-groups-edit" ).get(0));
+      $("#main-content" ).find("#repository-groups-view-tabs-li-edit" ).find("a").html($.i18n.prop("edit"));
     }
 
     this.saveRepositoryGroup=function(repositoryGroup){
index ec69ac2a4c906cf40870fdedb4bdb1b9abf53957..12391a10698065cf2a6e5459a2f750b6298e58db 100644 (file)
@@ -147,10 +147,10 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
       return entries;
     }
     displayArtifactInfo=function(){
-      if ($("#main-content #artifact-info:visible" ).length>0) {
-        $("#main-content #artifact-info" ).hide();
+      if ($("#main-content").find("#artifact-info:visible" ).length>0) {
+        $("#main-content").find("#artifact-info" ).hide();
       } else {
-        $("#main-content #artifact-info" ).show();
+        $("#main-content").find("#artifact-info" ).show();
       }
     }
 
@@ -483,7 +483,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
           success:function(data){
             self.artifacts.remove(artifact);
             displaySuccessMessage( $.i18n.prop('artifact.deleted'));
-            $("#main-content #artifact-details-download-content" ).html(smallSpinnerImg());
+            $("#main-content").find("#artifact-details-download-content" ).html(smallSpinnerImg());
             // reload datas from server
             var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(self.artifactVersionDetailViewModel.groupId);
             artifactDownloadInfosUrl+="/"+encodeURIComponent(self.artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(self.artifactVersionDetailViewModel.version);
@@ -557,7 +557,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
         if(classifier){
           entriesUrl+="&c="+encodeURIComponent(classifier);
         }
-        $("#main-content #artifact_content_tree").fileTree({
+        $("#main-content").find("#artifact_content_tree").fileTree({
           script: entriesUrl,
           root: ""
                  },function(file) {
@@ -855,7 +855,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
   }
 
   getSelectedBrowsingRepository=function(){
-    var selectedOption=$("#main-content #select_browse_repository option:selected" );
+    var selectedOption=$("#main-content").find("#select_browse_repository").find("option:selected" );
     if (selectedOption.length>0){
       var repoId=selectedOption.val();
       return repoId;
@@ -873,7 +873,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
     if (selectedRepo){
       url+="?repositoryId="+encodeURIComponent(selectedRepo);
     }
-    $( "#main-content #browse-autocomplete" ).autocomplete({
+    $( "#main-content").find("#browse-autocomplete" ).autocomplete({
       minLength: 2,
                        source: function(request, response){
         var query = "";
@@ -1412,7 +1412,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
   }
 
   applyAutocompleteOnHeader=function(property,resultViewModel){
-    $( "#main-content #search-filter-auto-"+property ).autocomplete({
+    $( "#main-content").find("#search-filter-auto-"+property ).autocomplete({
       minLength: 0,
                        source: function(request, response){
         var founds=[];
@@ -1543,7 +1543,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
       if ($.trim(queryTerm).length<1){
         var errorList=[{
           message: $.i18n.prop("search.artifact.search.form.terms.empty"),
-                 element: $("#main-content #search-basic-form #search-terms" ).get(0)
+                 element: $("#main-content").find("#search-basic-form").find("#search-terms" ).get(0)
         }];
         customShowError("#main-content #search-basic-form", null, null, errorList);
         return;
index a3831c99c4130cbd998abee3cde045ae80c7c45e..eaa13b1f9d09f28fc09d485d72eb557be663d251 100644 (file)
@@ -163,8 +163,9 @@ require(["jquery","jquery.tmpl","i18n"], function(jquery,jqueryTmpl,i18n) {
     }
     $("#dialog-confirm-modal-header-title").html(title);
     $("#dialog-confirm-modal-body-text").html(bodyText);
+    var dialogConfirmModalOk=$("#dialog-confirm-modal-ok");
     if (okMessage){
-      $("#dialog-confirm-modal-ok").html(okMessage);
+      dialogConfirmModalOk.html(okMessage);
     }
     if (cancelMessage){
       dialogCancel.html(cancelMessage);
@@ -172,7 +173,7 @@ require(["jquery","jquery.tmpl","i18n"], function(jquery,jqueryTmpl,i18n) {
     window.modalConfirmDialog.modal('show');
 
     // unbind previous events !!
-    var dialogConfirmModalOk=$("#dialog-confirm-modal-ok");
+
     dialogConfirmModalOk.off( );
     dialogConfirmModalOk.on("click", okFn);
 
index 3a7d0a9542bb06376c3af85159f7720f34699bf9..347436fe58ef5dc4549da7a0b6c2da04a0bfeead 100644 (file)
@@ -97,8 +97,9 @@ define("redback",["jquery","utils","jquery.validate","jquery.json","knockout",
    * open the register modal box
    */
   registerBox=function(){
+    var modalRegister=$("#modal-register");
     if (window.modalRegisterWindow==null) {
-      window.modalRegisterWindow = $("#modal-register").modal({backdrop:'static',show:false});
+      window.modalRegisterWindow = modalRegister.modal({backdrop:'static',show:false});
       window.modalRegisterWindow.bind('hidden', function () {
         $("#modal-register-err-message").hide();
       })
@@ -109,7 +110,7 @@ define("redback",["jquery","utils","jquery.validate","jquery.json","knockout",
         customShowError("#user-register-form",validator,errorMap,errorMap);
       }
     });
-    $("#modal-register").delegate("#modal-register-ok", "click keydown keypress", function(e) {
+    modalRegister.delegate("#modal-register-ok", "click keydown keypress", function(e) {
       e.preventDefault();
       register();
     });
index 46fae1b6f278678a041ec109c60f898b5570e1e8..53c5e1970fbcaadbff88adc7d0164be31fa75c75 100644 (file)
@@ -312,34 +312,34 @@ define("redback.roles",["jquery","utils","i18n","jquery.validate","knockout","kn
   }
 
   activateRolesGridTab=function(){
-    $("#main-content #roles-view-tabs li").removeClass("active");
-    $("#main-content #roles-view-tabs-content div").removeClass("active");
+    $("#main-content").find("#roles-view-tabs").find("li").removeClass("active");
+    $("#main-content").find("#roles-view-tabs-content").find("div").removeClass("active");
     // activate roles grid tab
-    $("#main-content #roles-view-tabs-content #roles-view").addClass("active");
-    $("#main-content #roles-view-tabs-li-roles-grid").addClass("active");
+    $("#main-content").find("#roles-view-tabs-content").find("#roles-view").addClass("active");
+    $("#main-content").find("#roles-view-tabs-li-roles-grid").addClass("active");
   }
 
   activateRoleEditTab=function(){
-    $("#main-content #roles-view-tabs li").removeClass("active");
-    $("#main-content #roles-view-tabs-content div").removeClass("active");
+    $("#main-content").find("#roles-view-tabs").find("li").removeClass("active");
+    $("#main-content").find("#roles-view-tabs-content").find("div").removeClass("active");
     // activate role edit tab
-    $("#main-content #roles-view-tabs-content #role-edit").addClass("active");
+    $("#main-content").find("#roles-view-tabs-content").find("#role-edit").addClass("active");
     $("#roles-view-tabs-li-roles-edit").addClass("active");
   }
 
   activateRoleUsersListTab=function(){
-    $("#main-content #role-edit-users-li").removeClass("active");
-    $("#main-content #role-edit-users").removeClass("active");
+    $("#main-content").find("#role-edit-users-li").removeClass("active");
+    $("#main-content").find("#role-edit-users").removeClass("active");
     // activate roles grid tab
-    $("#main-content #role-view-users-li").addClass("active");
-    $("#main-content #role-view-users").addClass("active");
+    $("#main-content").find("#role-view-users-li").addClass("active");
+    $("#main-content").find("#role-view-users").addClass("active");
   }
 
   activateRoleUsersEditTab=function(){
-    $("#main-content #role-view-users-li").removeClass("active");
-    $("#main-content #role-view-users").removeClass("active");
+    $("#main-content").find("#role-view-users-li").removeClass("active");
+    $("#main-content").find("#role-view-users").removeClass("active");
     // activate role edit tab
-    $("#main-content #role-edit-users").addClass("active");
+    $("#main-content").find("#role-edit-users").addClass("active");
     $("#role-edit-users-li").addClass("active");
   }
 
index 3994edc580da3851d18d482d5ccbfb2a83b6a0ea..fb01642a78f0a6df616ad5562cecd92919c584b2 100644 (file)
@@ -107,7 +107,7 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
                 successFnCallback(currentUser);
               }
               clearForm("#main-content #user-create");
-              $("#main-content #user-create").hide();
+              $("#main-content").find("#user-create").hide();
               activateUsersGridTab();
               return this;
             } else {
@@ -170,7 +170,7 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
             if (updated == true) {
               clearUserMessages();
               displaySuccessMessage($.i18n.prop("user.updated",currentUser.username()));
-              $("#main-content #users-view-tabs-li-user-edit a").html($.i18n.prop("add"));
+              $("#main-content").find("#users-view-tabs-li-user-edit").find("a").html($.i18n.prop("add"));
               clearForm("#main-content #user-create");
               activateUsersGridTab();
               return this;
@@ -188,7 +188,7 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
     this.save=function(){
       $.log("user.save create:"+window.redbackModel.createUser);
       if (window.redbackModel.createUser==true){
-        var valid = $("#main-content #user-create").valid();
+        var valid = $("#main-content").find("#user-create").valid();
 
         if (valid==false) {
           $.log("user#save valid:false");
@@ -298,7 +298,7 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
    * open a modal box to create admin user
    */
   adminCreateBox=function() {
-
+    var mainContent=$("#main-content");
 
     $.ajax("restServices/redbackServices/userService/isAdminUserExists", {
       type: "GET",
@@ -308,9 +308,9 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
         if (adminExists == false) {
 
           window.redbackModel.createUser=true;
-          $("#main-content").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
+          mainContent.attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
           var viewModel = new AdminUserViewModel();
-          ko.applyBindings(viewModel,$("#main-content" ).get(0));
+          ko.applyBindings(viewModel,mainContent.get(0));
           $.log("adminCreateBox");
           $("#user-create").validate({
             rules: {
@@ -420,8 +420,9 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
       decorateMenuWithKarma(user);
       return;
     }
-    $("#modal-login-err-message").html($.i18n.prop("incorrect.username.password"));
-    $("#modal-login-err-message").show();
+    var modalLoginErrMsg=$("#modal-login-err-message");
+    modalLoginErrMsg.html($.i18n.prop("incorrect.username.password"));
+    modalLoginErrMsg.show();
   }
 
   /**
@@ -487,11 +488,12 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
   }
 
   passwordReset=function(){
-    var username = $("#user-login-form-username" ).val();
+    var userLoginFormUsername=$("#user-login-form-username" );
+    var username = userLoginFormUsername.val();
     if(username.trim().length<1){
       var errorList=[{
         message: $.i18n.prop("username.cannot.be.empty"),
-                 element: $("#user-login-form-username").get(0)
+                 element: userLoginFormUsername.get(0)
       }];
       customShowError("#user-login-form", null, null, errorList);
       return;
@@ -627,7 +629,7 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
       window.modalEditUserBox.bind('hidden', function () {
         $("#modal-user-edit-err-message").hide();
       })
-      $("#modal-user-edit #modal-user-edit-ok").on( "click keydown keypress", function(e) {
+      $("#modal-user-edit").find("#modal-user-edit-ok").on( "click keydown keypress", function(e) {
         e.preventDefault();
         $.log("user.js#editUserDetailsBox");
         var valid = $("#user-edit-form").valid();
@@ -636,19 +638,19 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
         }
         var user = {
           username:currentUser.username,
-          fullName:$("#modal-user-edit #fullname").val(),
-          email:$("#modal-user-edit #email").val(),
-          previousPassword:$("#modal-user-edit #userEditFormCurrentPassword").val(),
-          password:$("#modal-user-edit #userEditFormNewPassword").val(),
-          confirmPassword:$("#modal-user-edit #userEditFormNewPasswordConfirm").val()
+          fullName:$("#modal-user-edit").find("#fullname").val(),
+          email:$("#modal-user-edit").find("#email").val(),
+          previousPassword:$("#modal-user-edit").find("#userEditFormCurrentPassword").val(),
+          password:$("#modal-user-edit").find("#userEditFormNewPassword").val(),
+          confirmPassword:$("#modal-user-edit").find("#userEditFormNewPasswordConfirm").val()
         };
         editUserDetails(user);
       });
     }
     var currentUser = getUserFromLoginCookie();
-    $("#modal-user-edit #username").html(currentUser.username);
-    $("#modal-user-edit #fullname").val(currentUser.fullName);
-    $("#modal-user-edit #email").val(currentUser.email);
+    $("#modal-user-edit").find("#username").html(currentUser.username);
+    $("#modal-user-edit").find("#fullname").val(currentUser.fullName);
+    $("#modal-user-edit").find("#email").val(currentUser.email);
     window.modalEditUserBox.modal('show');
     $("#user-edit-form").validate({
       rules: {
index fd8502b8b51837b0c5e5b1a57ec3146621d7b84f..e4778b38613fa4ae748322277493a04f1ba6d07b 100644 (file)
@@ -216,7 +216,7 @@ define("redback.users",["jquery","utils","i18n","jquery.validate","knockout","kn
     }
 
     saveUser=function(){
-      var valid = $("#main-content #user-create").valid();
+      var valid = $("#main-content").find("#user-create").valid();
       if (valid==false) {
         return;
       }