community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbo...@apache.org
Subject svn commit: r1667807 - /comdev/projects.apache.org/site/js/projects.js
Date Thu, 19 Mar 2015 16:19:46 GMT
Author: rbowen
Date: Thu Mar 19 16:19:46 2015
New Revision: 1667807

URL: http://svn.apache.org/r1667807
Log:
avoid copy paste for TLP vs sub-project icon and put the icon on the 
left to have full alignment
Patch (and previous three patches) thanks to Herve Boutemy!

Modified:
    comdev/projects.apache.org/site/js/projects.js

Modified: comdev/projects.apache.org/site/js/projects.js
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/site/js/projects.js?rev=1667807&r1=1667806&r2=1667807&view=diff
==============================================================================
--- comdev/projects.apache.org/site/js/projects.js (original)
+++ comdev/projects.apache.org/site/js/projects.js Thu Mar 19 16:19:46 2015
@@ -475,6 +475,14 @@ function camelCase(str) {
     return str.replace(/^([a-z])(.+)$/, function(c,a,b) { return a.toUpperCase() + b.toLowerCase()
} );
 }
 
+function projectIcon(name) {
+    if (isTLP(name)) {
+	return "<img src='/images/tlp.png' title='Top Level Project' style='vertical-align: middle;
padding: 2px;'/>"
+    } else {
+	return "<img src='/images/sub.png' title='Sub-project' style='vertical-align: middle;
padding: 2px;'/>"
+    }
+}
+
 function renderProjectsList(cat) {
 
     var obj = document.getElementById('contents');
@@ -502,12 +510,7 @@ function renderProjectsList(cat) {
 	for (i in arr) {
 	    project = arr[i]
 	    var li = document.createElement('li');
-	    li.innerHTML = "<a href='/project.html?" + project + "'>" + projects[project].name
+ "</a>";
-	    if (isTLP(projects[project].name)) {
-		li.innerHTML += "<img src='/images/tlp.png' title='Top Level Project' style='vertical-align:
middle; padding: 2px;'/>"
-	    } else {
-		li.innerHTML += "<img src='/images/sub.png' title='Sub-project' style='vertical-align:
middle; padding: 2px;'/>"
-	    }
+	    li.innerHTML = projectIcon(projects[project].name) + "<a href='/project.html?" +
project + "'>" + projects[project].name + "</a>";
 	    ul.appendChild(li)
 	}
 	obj.appendChild(ul);
@@ -551,12 +554,7 @@ function renderProjectsList(cat) {
 		    for (x in a) {
 			if (a[x].toLowerCase() == lang.toLowerCase()) {
 			    var cli = document.createElement('li');
-			    cli.innerHTML = "<a href='/project.html?" + i + "'>" + projects[i].name + "</a>";
-			    if (isTLP(projects[i].name)) {
-				cli.innerHTML += "<img src='/images/tlp.png' title='Top Level Project' style='vertical-align:
middle; padding: 2px;'/>"
-			    } else {
-				cli.innerHTML += "<img src='/images/sub.png' title='Sub-project' style='vertical-align:
middle; padding: 2px;'/>"
-			    }
+			    cli.innerHTML = projectIcon(projects[i].name) + "<a href='/project.html?" + i +
"'>" + projects[i].name + "</a>";
 			    cul.appendChild(cli)
 			}
 		    }
@@ -609,12 +607,7 @@ function renderProjectsList(cat) {
 			a[x] = a[x].replace("http://projects.apache.org/category/", "").toLowerCase();
 			if (a[x] == lang) {
 			    var cli = document.createElement('li');
-			    cli.innerHTML = "<a href='/project.html?" + i + "'>" + projects[i].name + "</a>";
-			    if (isTLP(projects[i].name)) {
-				cli.innerHTML += "<img src='/images/tlp.png' title='Top Level Project' style='vertical-align:
middle; padding: 2px;'/>"
-			    } else {
-				cli.innerHTML += "<img src='/images/sub.png' title='Sub-project' style='vertical-align:
middle; padding: 2px;'/>"
-			    }
+			    cli.innerHTML = projectIcon(projects[i].name) + "<a href='/project.html?" + i +
"'>" + projects[i].name + "</a>";
 			    cul.appendChild(cli)
 			}
 		    }
@@ -662,12 +655,7 @@ function renderProjectsList(cat) {
 		    xdate = committees[projects[i].name]
 		    if (xdate == date) {
 			var cli = document.createElement('li');
-			cli.innerHTML = "<a href='/project.html?" + i + "'>" + projects[i].name + "</a>";
-			if (isTLP(projects[i].name)) {
-			    cli.innerHTML += "<img src='/images/tlp.png' title='Top Level Project' style='vertical-align:
middle; padding: 2px;'/>"
-			} else {
-			    cli.innerHTML += "<img src='/images/sub.png' title='Sub-project' style='vertical-align:
middle; padding: 2px;'/>"
-			}
+			cli.innerHTML = projectIcon(projects[i].name) + "<a href='/project.html?" + i + "'>"
+ projects[i].name + "</a>";
 			cul.appendChild(cli)
 		    }
 		 }
@@ -712,12 +700,7 @@ function renderProjectsList(cat) {
 			var cli = document.createElement('li');
 			cli.innerHTML = "<a href='/project.html?" + i + "'>" + projects[i].name + "</a>:
" + len + " committers";
 			if (unixgroups[i+'-pmc']) {
-			    cli.innerHTML += ", " + unixgroups[i+'-pmc'].length + " PMC members";
-			    if (isTLP(projects[i].name)) {
-				cli.innerHTML += "<img src='/images/tlp.png' title='Top Level Project' style='vertical-align:
middle; padding: 2px;'/>"
-			    } else {
-				cli.innerHTML += "<img src='/images/sub.png' title='Sub-project' style='vertical-align:
middle; padding: 2px;'/>"
-			    }
+			    cli.innerHTML = projectIcon(projects[i].name) + cli.innerHTML + ", " + unixgroups[i+'-pmc'].length
+ " PMC members";
 			}
 			ul.appendChild(cli)
 		    }
@@ -771,12 +754,7 @@ function renderProjectsList(cat) {
 		    xlpmc = projects[i].pmc
 		    if (xlpmc == lpmc) {
 			var cli = document.createElement('li');
-			cli.innerHTML = "<a href='/project.html?" + i + "'>" + projects[i].name + "</a>";
-			if (isTLP(projects[i].name)) {
-			    cli.innerHTML += "<img src='/images/tlp.png' title='Top Level Project' style='vertical-align:
middle; padding: 2px;'/>"
-			} else {
-			    cli.innerHTML += "<img src='/images/sub.png' title='Sub-project' style='vertical-align:
middle; padding: 2px;'/>"
-			}
+			cli.innerHTML = projectIcon(projects[i].name) + "<a href='/project.html?" + i + "'>"
+ projects[i].name + "</a>";
 			cul.appendChild(cli)
 		    }
 		 }



Mime
View raw message