Merge "Top 10 companies links list supports now newest format of scm-companies.json"

This commit is contained in:
Jenkins 2014-10-11 11:23:15 +00:00 committed by Gerrit Code Review
commit bf833990ee
1 changed files with 18 additions and 6 deletions

View File

@ -37,15 +37,27 @@ var Openstack = {};
$.getJSON(json_file, null, function(data) {
var count = 0;
var links = "";
var links = "   ";
/*
Workaround here:
to scm-companies.json formats are available. Newest returns
an object, older just an array. For this feature we need an array
*/
if (!(data instanceof Array)){
if (data.hasOwnProperty('name'))
data = data.name;
}
$.each(data, function(index, company) {
if (count == 10) return false;
if (company === "Others") return true;
if (company.match("^\-")) return true;
link = '<a href="company.html?company=' + company +
'&data_dir=' + Report.getDataDir() + '">' + company + '</a> | ';
position = count +1;
link = '#'+position +'&nbsp;<a href="company.html?company=' + company +
'&data_dir=' + Report.getDataDir() + '">' + company + '</a>&nbsp;&nbsp;&nbsp;';
links = links + link;
++count;