optimize a bit selectors

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1366905 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-07-29 19:21:18 +00:00
parent c33dcecc9e
commit 44a0d63f4f
1 changed files with 10 additions and 8 deletions

View File

@ -886,7 +886,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
} }
reportStatisticsFormValidator=function(){ reportStatisticsFormValidator=function(){
var validate = $("#report-statistics-form-id").validate({ var validate = $("#main-content #report-statistics-form-id").validate({
rules: { rules: {
rowCountStatistics: { rowCountStatistics: {
required:true, required:true,
@ -901,23 +901,25 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
} }
}, },
showErrors: function(validator, errorMap, errorList) { showErrors: function(validator, errorMap, errorList) {
customShowError("#report-statistics-form-id", validator, errorMap, errorMap); $.log("showErrors");
customShowError("#main-content #report-statistics-form-id", validator, errorMap, errorMap);
} }
}) })
} }
ReportStatisticsViewModel=function(repositoriesAvailable){ ReportStatisticsViewModel=function(repositoriesAvailable){
var mainContent=$("#main-content");
reportStatisticsFormValidator(); reportStatisticsFormValidator();
var self=this; var self=this;
this.availableRepositories = ko.observableArray( repositoriesAvailable ); this.availableRepositories = ko.observableArray( repositoriesAvailable );
this.statisticsReport = ko.observable( new StatisticsReportRequest() ); this.statisticsReport = ko.observable( new StatisticsReportRequest() );
$("#startDate" ).datepicker(); mainContent.find("#startDate" ).datepicker();
$("#endDate" ).datepicker(); mainContent.find("#endDate" ).datepicker();
$("#rowCount-info-button" ).popover(); mainContent.find("#rowCount-info-button" ).popover();
this.showStatistics=function() { this.showStatistics=function() {
if (!$("#report-statistics-form-id").valid()) { if (!mainContent.find("#report-statistics-form-id").valid()) {
return; return;
} }
if(this.statisticsReport().repositories().length==0){ if(this.statisticsReport().repositories().length==0){
@ -925,7 +927,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
return; return;
} }
clearUserMessages( "repositoriesErrorMessage" ); clearUserMessages( "repositoriesErrorMessage" );
var resultTabContent = $("#report-result"); var resultTabContent = mainContent.find("#report-result");
url = "restServices/archivaServices/reportServices/getStatisticsReport/?rowCount=" url = "restServices/archivaServices/reportServices/getStatisticsReport/?rowCount="
+ this.statisticsReport().rowCount(); + this.statisticsReport().rowCount();
@ -1064,7 +1066,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
return; return;
} }
var resultTabContent = $("#report-result"); var resultTabContent = $("#main-content #report-result");
var url = var url =
"restServices/archivaServices/reportServices/getHealthReports/" + this.healthReport().repositoryId() + "/" "restServices/archivaServices/reportServices/getHealthReports/" + this.healthReport().repositoryId() + "/"