Skip to content

Commit b49b1f7

Browse files
committed
Fixes Issue astropy#42 seperates the table based on provisional column
1 parent 7a37a55 commit b49b1f7

2 files changed

Lines changed: 86 additions & 21 deletions

File tree

‎affiliated/index.html‎

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,47 @@ <h3>In development</h3>
122122
</section>
123123
<section id="affiliated-package-registry">
124124

125-
<h2>Affiliated Packages Registry</h2>
125+
<h3>Affiliated Packages Registry</h3>
126126

127127
<p>The following table lists all currently registered affiliated packages. This table is determined from the <a href="http://www.astropy.org/affiliated/registry.json">json file</a>, which is the actual authoritative registry.</p>
128-
128+
<h2>Affiliated packages</h2>
129129
<table border="1" class="docutils">
130130
<colgroup>
131131
<col width="17%" />
132132
<col width="10%" />
133+
<col width="14%" />
134+
<col width="13%" />
135+
<col width="21%" />
136+
<col width="14%" />
137+
</colgroup>
138+
<thead valign="bottom">
139+
<tr class="row-odd"><th class="head">Package Name</th>
140+
<th class="head">Stable</th>
141+
<th class="head">PyPI Name</th>
142+
<th class="head">Web Page</th>
143+
<th class="head">Code Repository</th>
144+
<th class="head">Maintainer</th>
145+
</tr>
146+
</thead>
147+
<tbody valign="top">
148+
<tr class="row-even"><td rowspan="2">Loading...</td>
149+
<td rowspan="2">&nbsp;</td>
150+
<td rowspan="2">&nbsp;</td>
151+
<td rowspan="2">&nbsp;</td>
152+
<td rowspan="2">&nbsp;</td>
153+
<td rowspan="2">&nbsp;</td>
154+
<td rowspan="2">&nbsp;</td>
155+
</tr>
156+
<tr class="row-odd"></tr>
157+
</tbody>
158+
</table>
159+
<p>The Stable column indicates whether the package maintainer consider the package to be ready for use. Packages that are under heavy development and for which the user interface is likely to change significantly in the near future are marked as No.</p>
160+
<hr>
161+
<!-- Not provisional -->
162+
<h3>Provisionally accepted Affiliated Packages</h3>
163+
<table border="1" class="docutils">
164+
<colgroup>
165+
<col width="17%" />
133166
<col width="10%" />
134167
<col width="14%" />
135168
<col width="13%" />
@@ -139,7 +172,6 @@ <h2>Affiliated Packages Registry</h2>
139172
<thead valign="bottom">
140173
<tr class="row-odd"><th class="head">Package Name</th>
141174
<th class="head">Stable</th>
142-
<th class="head">Provisional</th>
143175
<th class="head">PyPI Name</th>
144176
<th class="head">Web Page</th>
145177
<th class="head">Code Repository</th>
@@ -159,8 +191,7 @@ <h2>Affiliated Packages Registry</h2>
159191
</tbody>
160192
</table>
161193

162-
<p>The Stable column indicates whether the package maintainer consider the package to be ready for use. Packages that are under heavy development and for which the user interface is likely to change significantly in the near future are marked as No.</p>
163-
<p>The Provisional column indicates packages that have been provisionally accepted as affiliated packages, but may be removed from the registry in the future if they don't make sufficient progress towards meeting Astropy standards (See below for more).</p>
194+
<p>The above table indicates packages that have been provisionally accepted as affiliated packages, but may be removed from the registry in the future if they don't make sufficient progress towards meeting Astropy standards (See below for more).</p>
164195

165196
</section>
166197
<section id="affiliated-instructions">

‎js/functions.js‎

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $( document ).ready(function(){
3232
// If the location.hash matches one of the links, use that as the active tab.
3333
// If no location.hash is given, use a tab determined by guess_os()
3434
// If no match is found, use the first link as the initial active tab.
35-
hash = (location.hash == "") ? '#' + guess_os() : location.hash;
35+
hash = (location.hash === "") ? '#' + guess_os() : location.hash;
3636
$active = $($links.filter('[href="'+hash+'"]')[0] || $links[0]);
3737
$active.addClass('active');
3838
$content = $($active.attr('href'));
@@ -141,15 +141,21 @@ function maintainer_translator(maint, pkgnm) {
141141
function populateTable(data, tstat, xhr) {
142142
var regdiv = document.getElementById('affiliated-package-registry');
143143
var tab = regdiv.getElementsByTagName('table')[0];
144+
var provtab = regdiv.getElementsByTagName('table')[1];
144145
tab.deleteRow(1);
146+
provtab.deleteRow(1);
145147
var ncols = tab.rows[0].cells.length;
148+
var provncols = provtab.rows[0].cells.length;
146149

147-
var pkgi, row, nmcell, stablecell, pypicell, urlcell, rpocell, maintcell;
150+
var pkgi, provrow, row, nmcell, stablecell, pypicell, urlcell, rpocell, maintcell;
148151
if (data === null) {
149152
row = tab.insertRow(1);
153+
provrow = provtab.insertRow(1);
150154
row.insertCell(0).innerHTML = 'Could not load registry file!';
155+
provrow.insertCell(0).innerHTML = 'Could not load registry file!';
151156
for (i=0;i<(ncols - 1);i++) {
152157
row.insertCell(i + 1).innerHTML = ' ';
158+
provrow.insertCell(i + 1).innerHTML = ' ';
153159
}
154160
} else {
155161
var pkgs = data.packages;
@@ -164,26 +170,54 @@ function populateTable(data, tstat, xhr) {
164170
}
165171
// This "sorts" the indecies using a compare function that actually sorts nmarr
166172
sortorder.sort(function (a, b) { return nmarr[a] < nmarr[b] ? -1 : nmarr[a] > nmarr[b] ? 1 : 0; });
173+
console.log(sortorder);
174+
var falseProvisional = [];
175+
// Creared to store all those values from registry.json which are not provisional packages.
167176

168177
for (i=0; i<sortorder.length; i++) {
169178
pkgi = pkgs[sortorder[i]];
170179
row = tab.insertRow(i + 1);
171-
180+
if(pkgi.provisional === false) {
181+
falseProvisional.push(pkgi);
182+
}
183+
else {
184+
nmcell = row.insertCell(0);
185+
stablecell = row.insertCell(1);
186+
pypicell = row.insertCell(2);
187+
urlcell = row.insertCell(3);
188+
repocell = row.insertCell(4);
189+
maintcell = row.insertCell(5);
190+
191+
nmcell.innerHTML = pkgi.name;
192+
stablecell.innerHTML = bool_translator(pkgi.stable);
193+
pypicell.innerHTML = pypi_translator(pkgi.pypi_name);
194+
urlcell.innerHTML = url_translator(pkgi.home_url);
195+
repocell.innerHTML = url_translator(pkgi.repo_url);
196+
maintcell.innerHTML = maintainer_translator(pkgi.maintainer, pkgi.name);
197+
}
198+
}
199+
for(x=0; x<falseProvisional.length; x++) {
200+
row = provtab.insertRow(x + 1);
172201
nmcell = row.insertCell(0);
173202
stablecell = row.insertCell(1);
174-
provisionalcell = row.insertCell(2);
175-
pypicell = row.insertCell(3);
176-
urlcell = row.insertCell(4);
177-
repocell = row.insertCell(5);
178-
maintcell = row.insertCell(6);
179-
180-
nmcell.innerHTML = pkgi.name;
181-
stablecell.innerHTML = bool_translator(pkgi.stable);
182-
provisionalcell.innerHTML = bool_translator(pkgi.provisional);
183-
pypicell.innerHTML = pypi_translator(pkgi.pypi_name);
184-
urlcell.innerHTML = url_translator(pkgi.home_url);
185-
repocell.innerHTML = url_translator(pkgi.repo_url);
186-
maintcell.innerHTML = maintainer_translator(pkgi.maintainer, pkgi.name);
203+
pypicell = row.insertCell(2);
204+
urlcell = row.insertCell(3);
205+
repocell = row.insertCell(4);
206+
maintcell = row.insertCell(5);
207+
208+
var provisionalObject = falseProvisional[x];
209+
if(provisionalObject.stable === true) {
210+
provisionalObject.stable = 'Yes';
211+
}
212+
else {
213+
provisionalObject.stable = 'No';
214+
}
215+
nmcell.innerHTML = provisionalObject.name;
216+
stablecell.innerHTML = provisionalObject.stable;
217+
pypicell.innerHTML = pypi_translator(provisionalObject.pypi_name);
218+
urlcell.innerHTML = url_translator(provisionalObject.home_url);
219+
repocell.innerHTML = url_translator(provisionalObject.repo_url);
220+
maintcell.innerHTML = maintainer_translator(provisionalObject.maintainer, pkgi.name);
187221
}
188222
}
189223
}

0 commit comments

Comments
 (0)