community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1757079 - /comdev/projects.apache.org/site/js/projects.js
Date Sun, 21 Aug 2016 19:50:53 GMT
Author: sebb
Date: Sun Aug 21 19:50:53 2016
New Revision: 1757079

URL: http://svn.apache.org/viewvc?rev=1757079&view=rev
Log:
Simplify.
Only convert names to lower case once

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=1757079&r1=1757078&r2=1757079&view=diff
==============================================================================
--- comdev/projects.apache.org/site/js/projects.js (original)
+++ comdev/projects.apache.org/site/js/projects.js Sun Aug 21 19:50:53 2016
@@ -581,12 +581,13 @@ function renderCommitteePage(committeeId
             subprojects.push(p);
         }
     }
-    if ((subprojects.length == 0) && (committeeId != 'comdev') && (committeeId
!= 'labs')) {
-        // if a committee did not declare any project, consider there is a default one with
the id of the committee
-        // only Labs and Community Development don't manage projects
-        subprojects.push({ 'id': committeeId, 'name': committee.name, 'pmc': committeeId
});
-    }
-    if (subprojects.length >= 1) {
+    if (subprojects.length == 0) {
+       if ((committeeId != 'comdev') && (committeeId != 'labs')) {
+           // if a committee did not declare any project, consider there is a default one
with the id of the committee
+            // only Labs and Community Development don't manage projects
+            subprojects.push({ 'id': committeeId, 'name': committee.name, 'pmc': committeeId
});
+        }
+    } else {
         appendElementWithInnerHTML(obj, 'h4', "Projects managed by this Committee:");
 
         ul = document.createElement('ul');
@@ -641,9 +642,10 @@ function sortProjects() {
     var projectsSortedX = [];
     var projectsSorted = [];
     for (i in projects) {
-        projectsSortedX.push([i, projects[i].name]);
+        projectsSortedX.push([i, projects[i].name.toLowerCase()]);
     }
-    projectsSortedX.sort(function(a,b) { return a[1].toLowerCase() > b[1].toLowerCase()
? 1 : a[1].toLowerCase() < b[1].toLowerCase() ? -1 : 0 })
+    // compare names (already lower-cased)
+    projectsSortedX.sort(function(a,b) { return a[1] > b[1] ? 1 : a[1] < b[1] ? -1
: 0 })
     for (i in projectsSortedX) {
         projectsSorted.push(projectsSortedX[i][0]);
     }
@@ -887,9 +889,10 @@ function sortCommittees() {
     var committeesSortedX = [];
     var committeesSorted = [];
     for (i in committees) {
-        committeesSortedX.push([i, committees[i].name]);
+        committeesSortedX.push([i, committees[i].name.toLowerCase()]);
     }
-    committeesSortedX.sort(function(a,b) { return a[1].toLowerCase() > b[1].toLowerCase()
? 1 : a[1].toLowerCase() < b[1].toLowerCase() ? -1 : 0 })
+    // compare names (already lower-cased)
+    committeesSortedX.sort(function(a,b) { return a[1] > b[1] ? 1 : a[1] < b[1] ? -1
: 0 })
     for (i in committeesSortedX) {
         committeesSorted.push(committeesSortedX[i][0]);
     }



Mime
View raw message