Skip to content

Commit

Permalink
dev/builds: let the two build filters interact with each other properly
Browse files Browse the repository at this point in the history
The user can now alternate between clicking a build description and
choosing a build option from the pull-down form and the results will be
as expected.
  • Loading branch information
dfandrich committed Jul 20, 2014
1 parent d4e82a3 commit 4985964
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions dev/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ function showFilter() {
}
}

var linefilter = "";

/* Hide all rows on the build page that don't match the given options */
function filterBuilds(selected) {
/* The build filter invalidates the line filter */
linefilter = "";

/* Select the chosen option on all filter forms on the page */
var selects = document.getElementsByClassName("filterinput");
for (var i=0; i<selects.length; i++) {
Expand Down Expand Up @@ -74,15 +79,26 @@ function filterBuilds(selected) {
}
}

var linefilter = "";
function filterLine() {
var selected;

/* Alternate between showing all and showing just this build */
if (linefilter) {
linefilter = "";
selected = 0; /* All */
}
else {
linefilter = "none";
selected = -1; /* invalid */
}
/* Invalidate all filter forms on the page (or set to All,
as appropriate). This allows the user to use the build filter form
and get the results he expects. */
var selects = document.getElementsByClassName("filterinput");
for (var i=0; i<selects.length; i++) {
selects[i].selectedIndex = selected;
}

/* Start by hiding everything */
var rows = document.getElementsByClassName("even");
for (var i=0; i<rows.length; i++) {
Expand Down Expand Up @@ -110,7 +126,7 @@ function filterLine() {

function installLineFilter() {
var rows = document.getElementsByClassName("even");
// Set an onclick handler for the build description
/* Set an onclick handler for the build description */
for (var i=0; i<rows.length; i++) {
/* TODO: use a special class for the description TD element
to future proof this */
Expand Down

0 comments on commit 4985964

Please sign in to comment.