community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1679371 - /comdev/projects.apache.org/site/js/projects.js
Date Thu, 14 May 2015 13:48:14 GMT
Author: hboutemy
Date: Thu May 14 13:48:13 2015
New Revision: 1679371

URL: http://svn.apache.org/r1679371
Log:
code cleanup: move category cleanup in one place

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=1679371&r1=1679370&r2=1679371&view=diff
==============================================================================
--- comdev/projects.apache.org/site/js/projects.js (original)
+++ comdev/projects.apache.org/site/js/projects.js Thu May 14 13:48:13 2015
@@ -304,8 +304,7 @@ function renderProjectPage(json, state)
 
     // Categories
     if (json['category']) {
-	var pl = json['category'].replace(new RegExp("http://projects.apache.org/category/", 'g'),
'').toLowerCase();
-	var arr = pl.split(/,\s*/);
+	var arr = json['category'].split(/,\s*/);
 	var pls = "";
 	for (i in arr) {
 	    var cat = arr[i];
@@ -545,7 +544,7 @@ function renderProjectsList(cat) {
 	var ccount = {};
 	for (i in projects) {
 	    if (projects[i].category) {
-		var a = projects[i].category.replace(new RegExp("http://projects.apache.org/category/",
'g'), '').toLowerCase().split(/,\s*/);
+		var a = projects[i].category.split(/,\s*/);
 		for (x in a) {
                     x = a[x];
 		    if (cats.indexOf(x) < 0) {
@@ -571,7 +570,7 @@ function renderProjectsList(cat) {
 		i = projectsSorted[i];
                 var project = projects[i];
 		if (project.category) {
-                    var a = project.category.replace(new RegExp("http://projects.apache.org/category/",
'g'), '').toLowerCase().split(/,\s*/);
+                    var a = project.category.split(/,\s*/);
 		    for (x in a) {
 			x = a[x];
 			if (x == lang) {
@@ -771,14 +770,11 @@ function buildProjectListAsTable(json) {
 	    pmc = "Apache Incubator";
 	}
 	
-	// Project category, minus the old RDF cruft
-	var cat = (project.category ? project.category : "").replace(/http:\/\/projects.apache.org\/category\/?/g,
"");
-	
 	// Programming language
 	var pl = project['programming-language'] ? project['programming-language'] : "Unknown";
 	
 	// Shove the result into a row
-	arr.push([ p, project.name, type, pmc, pl, cat])
+	arr.push([ p, project.name, type, pmc, pl, project.category])
     }
     
     // Construct the data table
@@ -1009,9 +1005,6 @@ function renderLanguageChart() {
 	i = projects[i];
 	if (i.category) {
 	    var a = i.category.split(", ");
-	    for (var x in a) {
-		a[x] = a[x].replace("http://projects.apache.org/category/", "");
-	    }
 	    for (x in a) {
 		if (cats.indexOf(a[x]) < 0) {
 		    cats.push(a[x]);
@@ -1193,6 +1186,10 @@ function checkKeyPress(e, txt) {
 function weaveInProjects(json) {
     for (p in json) {
 	if (!projects[p]) {
+            if (json[p].category) {
+                // temporary hack: json are now generated without the http://projects.apache.org/category/
url
+                json[p].category = json[p].category.replace(new RegExp("http://projects.apache.org/category/",
'g'), '');
+            }
 	    projects[p] = json[p];
 	}
     }



Mime
View raw message