aboutsummaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-04-22 02:20:14 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-06-05 14:46:49 +0200
commit28fca6be6eed43da9b9449257a8577e4d8597590 (patch)
tree6b1fcf2df774a42b82e8958c7622ea0f926a8d39 /data
parentca6d6953457b0176f9aed372367cb2645e575f3e (diff)
downloadbugzilla-triage-28fca6be6eed43da9b9449257a8577e4d8597590.tar.gz
Add the roll-down list for selection of categories.
Diffstat (limited to 'data')
-rw-r--r--data/lib/otherButtons.js6
-rw-r--r--data/lib/rhbzpage.js4
-rw-r--r--data/lib/xorgBugCategories.js51
3 files changed, 60 insertions, 1 deletions
diff --git a/data/lib/otherButtons.js b/data/lib/otherButtons.js
index 3a1f76a..7a11395 100644
--- a/data/lib/otherButtons.js
+++ b/data/lib/otherButtons.js
@@ -60,7 +60,11 @@ function markBugTriaged() {
// /fedora-meeting.2009-11-24-15.11.log.html
// http://meetbot.fedoraproject.org/fedora-meeting/2009-11-24\
// /fedora-meeting.2009-11-24-15.11.log.html
- addStuffToTextBox("keywords","Triaged");
+ if (!hasXorgBugsCategory()) {
+ alert("This won't do! First set the category!");
+ } else {
+ addStuffToTextBox("keywords","Triaged");
+ }
}
function addingEmbelishments(list) {
diff --git a/data/lib/rhbzpage.js b/data/lib/rhbzpage.js
index 43d34c2..8071c80 100644
--- a/data/lib/rhbzpage.js
+++ b/data/lib/rhbzpage.js
@@ -468,6 +468,10 @@ function RHBZinit() {
setDefaultAssignee();
}
+ if (constantData.xorgBugsCategories) {
+ makeBugCategoriesList(constantData.xorgBugsCategories);
+ }
+
// Dig out backtrace protection against double-firing?
btSnippet = "";
diff --git a/data/lib/xorgBugCategories.js b/data/lib/xorgBugCategories.js
new file mode 100644
index 0000000..f47ad1d
--- /dev/null
+++ b/data/lib/xorgBugCategories.js
@@ -0,0 +1,51 @@
+// Released under the MIT/X11 license
+// http://www.opensource.org/licenses/mit-license.php
+"use strict";
+
+function hasXorgBugsCategory() {
+ var catRE = /\s*\[cat:.*?\]\s*/; // RE for testing whether
+ // there is already category tag in the Whiteboard
+
+ var whiteboardContent = document.
+ getElementById("status_whiteboard").value;
+ return (catRE.test(whiteboardContent));
+}
+
+/**
+ * Create a category list to the upper toolbar
+ */
+function makeBugCategoriesList(catList) {
+
+ // Create <select> element and add it first blank <option>
+ var targetDiv = document.getElementById("commit_top").parentNode;
+ var categoryList = document.createElement("select");
+ categoryList.setAttribute("id", "xorgBugsCategoriesSelect");
+ categoryList.setAttribute("name", "xorgBugsCategoriesSelect");
+ var optionElement = document.createElement("option");
+ optionElement.value = null;
+ optionElement.setAttribute("id", "catId_blank");
+ optionElement.appendChild(document.createTextNode("---"));
+ 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);
+ });
+
+ categoryList.addEventListener("change", function (evt) {
+ var selectedCategory = "[cat:" + this.value + "]";
+ var whiteboardElement = document.getElementById("status_whiteboard");
+
+ if (hasXorgBugsCategory()) {
+ whiteboardElement.value = whiteboardElement.
+ value.replace(catRE, "");
+ }
+ addStuffToTextBox("status_whiteboard", selectedCategory);
+ }, false);
+
+ targetDiv.insertBefore(categoryList, targetDiv.firstChild);
+}