archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1425379 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva: general-admin.js utils.js
Date Sun, 23 Dec 2012 00:00:19 GMT
Author: olamy
Date: Sun Dec 23 00:00:19 2012
New Revision: 1425379

URL: http://svn.apache.org/viewvc?rev=1425379&view=rev
Log:
reuse selector

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js?rev=1425379&r1=1425378&r2=1425379&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
Sun Dec 23 00:00:19 2012
@@ -1409,12 +1409,13 @@ define("archiva.general-admin",["jquery"
     }
 
     saveRedbackRuntimeConfiguration=function(){
-      var valid = $("#main-content").find("#redback-runtime-general-form-id").valid();
+      var mainContent=$("#main-content");
+      var valid = mainContent.find("#redback-runtime-general-form-id").valid();
       if (valid==false) {
         return;
       }
       $.log("saveRedbackRuntimeConfiguration");
-      var saveButton = $("#redback-runtime-configuration-save" );
+      var saveButton = mainContent.find("#redback-runtime-configuration-save" );
       saveButton.button('loading');
       clearUserMessages();
       var userMessages=$("#user-messages");
@@ -1474,7 +1475,8 @@ define("archiva.general-admin",["jquery"
   }
 
   activateRedbackRuntimeGeneralFormValidation=function(){
-    var validator = $("#main-content" ).find("#redback-runtime-general-form-id").validate({
+    var formSelector=$("#main-content" ).find("#redback-runtime-general-form-id");
+    var validator = formSelector.validate({
       rules: {
         usersCacheTimeToLiveSeconds : {
          digits: true,
@@ -1488,7 +1490,7 @@ define("archiva.general-admin",["jquery"
         }
       },
       showErrors: function(validator, errorMap, errorList) {
-       customShowError("#main-content #redback-runtime-general-form-id",validator,errorMap,errorMap);
+       customShowError(formSelector,validator,errorMap,errorMap);
       }
       });
   }

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js?rev=1425379&r1=1425378&r2=1425379&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
Sun Dec 23 00:00:19 2012
@@ -324,15 +324,25 @@ require(["jquery","jquery.tmpl","i18n","
     removeValidationErrorMessages(selector);
     for ( var i = 0; errorList[i]; i++ ) {
       var error = errorList[i];
-      var field = $(selector).find("#"+error.element.id);
+      if (typeof selector == 'string') {
+        var field = $(selector).find("#"+error.element.id);
+      } else {
+        var field = selector.find("#"+error.element.id);
+      }
       field.parents( "div.control-group" ).addClass( "error" );
       field.parent().append( "<span class=\"help-inline\">" + error.message + "</span>"
);
     }
   }
 
   removeValidationErrorMessages=function(selector){
-    $(selector).find("div.control-group" ).removeClass( "error" );
-    $(selector).find("span.help-inline").remove();
+    if (typeof selector == 'string') {
+      $(selector).find("div.control-group" ).removeClass( "error" );
+      $(selector).find("span.help-inline").remove();
+    } else {
+      selector.find("div.control-group" ).removeClass( "error" );
+      selector.find("span.help-inline").remove();
+    }
+
   }
 
   appendArchivaVersion=function(){



Mime
View raw message