You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2012/05/21 19:08:19 UTC
svn commit: r1341111 - in
/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js:
archiva/search.js archiva/utils.js templates/archiva/search.html
Author: olamy
Date: Mon May 21 17:08:18 2012
New Revision: 1341111
URL: http://svn.apache.org/viewvc?rev=1341111&view=rev
Log:
[MRM-1620] add a tab to browse artifact content in artifact detail view
pom view !
Modified:
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js?rev=1341111&r1=1341110&r2=1341111&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js Mon May 21 17:08:18 2012
@@ -279,15 +279,45 @@ define("search",["jquery","i18n","jquery
$.get(artifactDownloadInfosUrl,function(data){
$("#artifact-details-files-content" ).html($("#artifact-details-files-content_tmpl").tmpl({artifactDownloadInfos:data}));
- var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(self.groupId);
- entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
- entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
-
- $("#main-content #artifact_content_tree").fileTree({
- script: entriesUrl,
- root: ""
- },function(file) {
- });
+ mainContent.find("#artifact-content-list-files li" ).on("click",function(){
+ var idValue = $(this ).attr("id");
+ var classifier=idValue.substringBeforeLast(":");
+ var type = idValue.substringAfterLast(":");
+ $.log("click:" + idValue + " -> " + classifier + ":" + type );
+ if (type=="pom"){
+ $.log("show pom");
+ var pomContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(self.groupId);
+ pomContentUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
+ pomContentUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
+ pomContentUrl+="&t=pom";
+ $.ajax({
+ url: pomContentUrl,
+ dataType: "text",
+ success: function(data) {
+ $.log("foo");
+ $.log("data:"+data);
+ var text = data.replace(/</g,'<');
+ text=text.replace(/>/g,">");
+ mainContent.find("#artifact-content-text" ).html(text);
+ }
+ });
+ return;
+ }
+ var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(self.groupId);
+ entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
+ entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
+ if(classifier){
+ entriesUrl+="&c="+classifier;
+ }
+ $("#main-content #artifact_content_tree").fileTree({
+ script: entriesUrl,
+ root: ""
+ },function(file) {
+ $.log("file:"+file.substringBeforeLast("/")+',classifier:'+classifier);
+ }
+ );
+ });
+
});
}
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=1341111&r1=1341110&r2=1341111&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 Mon May 21 17:08:18 2012
@@ -389,6 +389,10 @@ define("utils",["jquery","i18n","jquery.
return this.substring(0,this.lastIndexOf(str));
}
+ String.prototype.substringAfterLast = function(str) {
+ return this.substring(this.lastIndexOf(str)+1);
+ }
+
//-----------------------------------------
// extends jquery tmpl to support var def
//-----------------------------------------
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html?rev=1341111&r1=1341110&r2=1341111&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html Mon May 21 17:08:18 2012
@@ -810,9 +810,11 @@
<script id="artifact-details-files-content_tmpl" type="text/html">
<div class="row">
<div class="span4">
- <ul>
+ <ul id="artifact-content-list-files">
{{each artifactDownloadInfos}}
- <li>${$value.type}:${$value.classifier}</li>
+ <li id="${$value.classifier}:${$value.type}">
+ <a href="#">${$value.type}</a>
+ </li>
{{/each}}
</ul>
</div>
@@ -821,4 +823,8 @@
</div>
</div>
</div>
+ <h4>Content</h4>
+ <div>
+ <pre id="artifact-content-text"></pre>
+ </div>
</script>
\ No newline at end of file