diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-04-22 04:05:34 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-04-22 04:05:34 +0200 |
commit | 62dc530470d6e6ec82f8c50dc65d7ddbb742748c (patch) | |
tree | ce95b1289e851f64221475d7fde58afd1adf5428 /data/lib/xorgBugCategories.js | |
parent | 716ea4208690274449e93ce01bf54646621fbb3e (diff) | |
download | bugzilla-triage-62dc530470d6e6ec82f8c50dc65d7ddbb742748c.tar.gz |
Make the categories work only for Xorg bugs.
Diffstat (limited to 'data/lib/xorgBugCategories.js')
-rw-r--r-- | data/lib/xorgBugCategories.js | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/data/lib/xorgBugCategories.js b/data/lib/xorgBugCategories.js index f47ad1d..8168f18 100644 --- a/data/lib/xorgBugCategories.js +++ b/data/lib/xorgBugCategories.js @@ -6,15 +6,23 @@ function hasXorgBugsCategory() { var catRE = /\s*\[cat:.*?\]\s*/; // RE for testing whether // there is already category tag in the Whiteboard + var isXOrgBug = filterByRegexp(constantData. + xorgBugsCategories, getComponent()); + console.myDebug("isXOrgBug = " + isXOrgBug); var whiteboardContent = document. getElementById("status_whiteboard").value; - return (catRE.test(whiteboardContent)); + console.myDebug("whiteboardContent = " + whiteboardContent); + console.myDebug("catRE.test = " + catRE.test(whiteboardContent)); + + return (isXOrgBug && catRE.test(whiteboardContent)); } /** * Create a category list to the upper toolbar */ function makeBugCategoriesList(catList) { + var catRE = /\s*\[cat:.*?\]\s*/; // RE for testing whether + // there is already category tag in the Whiteboard // Create <select> element and add it first blank <option> var targetDiv = document.getElementById("commit_top").parentNode; @@ -28,13 +36,16 @@ function makeBugCategoriesList(catList) { categoryList.appendChild(optionElement); // Fill-in <select> with <options>s for each category one - catList.forEach(function (cat) { - optionElement = document.createElement("option"); - optionElement.value = cat; - optionElement.setAttribute("id", "catId_" + cat.replace(" ","").toLowerCase()); - optionElement.appendChild(document.createTextNode(cat)); - categoryList.appendChild(optionElement); - }); + if (catList) { + catList.forEach(function (cat) { + optionElement = document.createElement("option"); + optionElement.value = cat; + optionElement.setAttribute("id", "catId_" + + cat.replace(" ","").toLowerCase()); + optionElement.appendChild(document.createTextNode(cat)); + categoryList.appendChild(optionElement); + }); + } categoryList.addEventListener("change", function (evt) { var selectedCategory = "[cat:" + this.value + "]"; |