next: avoid copy paste for TLP vs sub-project icon and put the icon on the left to have full alignment
Regards, Hervé Le dimanche 8 mars 2015 17:43:49 Hervé BOUTEMY a écrit : > and a third one: just white background instead of black > > Regards, > > Hervé > > Le dimanche 8 mars 2015 17:29:56 Hervé BOUTEMY a écrit : > > another one, with simple instructions to make local tests > > > > Regards, > > > > Hervé > > > > Le dimanche 8 mars 2015 17:23:36 Hervé BOUTEMY a écrit : > > > Hi, > > > > > > As promise, here is a first little patch: this is simply to add a link > > > to > > > our license, per our policy :) > > > > > > Regards, > > > > > > Hervé
Index: js/projects.js =================================================================== --- js/projects.js (révision 1665047) +++ js/projects.js (copie de travail) @@ -475,6 +475,14 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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) } }