avoid duplicate code

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1304367 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-23 14:24:34 +00:00
parent c51bba95bb
commit e90a94f273
2 changed files with 20 additions and 36 deletions

View File

@ -95,23 +95,7 @@ $(function() {
displayBrowseArtifactDetail(splitted[0],splitted[1],null,null);
return;
} else if (splitted.length==3) {
var mainContent=$("#main-content");
mainContent.html($("#browse-tmpl" ).tmpl());
mainContent.find("#browse_result" ).hide();
mainContent.find("#browse_artifact_detail").show();
mainContent.find("#browse_artifact_detail").html(mediumSpinnerImg());
mainContent.find("#browse_breadcrumb" ).show();
mainContent.find("#browse_breadcrumb" ).html(mediumSpinnerImg());
$.ajax("restServices/archivaServices/browseService/userRepositories", {
type: "GET",
dataType: 'json',
success: function(data) {
mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:repositoryId}));
var artifactVersionDetailViewModel=new ArtifactVersionDetailViewModel(splitted[0],splitted[1],splitted[2]);
artifactVersionDetailViewModel.display(true);
}
});
generaldisplayArtifactDetailsVersionView(splitted[0],splitted[1],splitted[2],repositoryId);
return;
} else {
displayWarningMessage( $.i18n.prop("shortcut.artifact.illegal"));

View File

@ -1027,34 +1027,34 @@ $(function() {
});
groupIdView=function(artifact){
$.log("groupIdView:"+artifact.groupId);
displayBrowseGroupId(artifact.groupId);
}
artifactIdView=function(artifact){
$.log("artifactIdView:"+artifact.groupId);
displayBrowseArtifactDetail(artifact.groupId,artifact.artifactId,null,null);
}
artifactDetailView=function(artifact){
$.log("artifactDetailView:"+artifact.groupId);
var mainContent=$("#main-content");
mainContent.html($("#browse-tmpl" ).tmpl());
mainContent.find("#browse_result" ).hide();
mainContent.find("#browse_artifact_detail").show();
mainContent.find("#browse_artifact_detail").html(mediumSpinnerImg());
mainContent.find("#browse_breadcrumb" ).show();
mainContent.find("#browse_breadcrumb" ).html(mediumSpinnerImg());
$.ajax("restServices/archivaServices/browseService/userRepositories", {
type: "GET",
dataType: 'json',
success: function(data) {
mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:null}));
var artifactVersionDetailViewModel=new ArtifactVersionDetailViewModel(artifact.groupId,artifact.artifactId,artifact.version);
artifactVersionDetailViewModel.display(true);
}
});
generaldisplayArtifactDetailsVersionView(artifact.groupId,artifact.artifactId,artifact.version,null);
}
}
generaldisplayArtifactDetailsVersionView=function(groupId,artifactId,version,repositoryId){
var mainContent=$("#main-content");
mainContent.html($("#browse-tmpl" ).tmpl());
mainContent.find("#browse_result" ).hide();
mainContent.find("#browse_artifact_detail").show();
mainContent.find("#browse_artifact_detail").html(mediumSpinnerImg());
mainContent.find("#browse_breadcrumb" ).show();
mainContent.find("#browse_breadcrumb" ).html(mediumSpinnerImg());
$.ajax("restServices/archivaServices/browseService/userRepositories", {
type: "GET",
dataType: 'json',
success: function(data) {
mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:repositoryId}));
var artifactVersionDetailViewModel=new ArtifactVersionDetailViewModel(groupId,artifactId,version);
artifactVersionDetailViewModel.display(true);
}
});
}
SearchViewModel=function(){
var self=this;