summaryrefslogtreecommitdiffstats
path: root/extensions/GuidedBugEntry/web/js
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2012-01-03 15:20:45 +0100
committerByron Jones <bjones@mozilla.com>2012-01-03 15:20:45 +0100
commit3bd91966b819ce30368d5df22059458beba9d12a (patch)
tree2ebe438edd2d848c1ceaa4e116f4fce855911f50 /extensions/GuidedBugEntry/web/js
parent173cf5e3efb836eb0e2ecffc9c87ebe82304cbe5 (diff)
downloadbugzilla-3bd91966b819ce30368d5df22059458beba9d12a.tar.gz
bugzilla-3bd91966b819ce30368d5df22059458beba9d12a.tar.xz
bug 713165: update guided bug entry to force firefox bugs into the untriaged component
Diffstat (limited to 'extensions/GuidedBugEntry/web/js')
-rw-r--r--extensions/GuidedBugEntry/web/js/guided.js100
-rw-r--r--extensions/GuidedBugEntry/web/js/products.js7
2 files changed, 79 insertions, 28 deletions
diff --git a/extensions/GuidedBugEntry/web/js/guided.js b/extensions/GuidedBugEntry/web/js/guided.js
index 4a12be49f..76d3ae799 100644
--- a/extensions/GuidedBugEntry/web/js/guided.js
+++ b/extensions/GuidedBugEntry/web/js/guided.js
@@ -168,6 +168,19 @@ var product = {
Dom.addClass("product_support", "hidden");
}
+ // show/hide component selection row
+ if (products[productName].noComponentSelection) {
+ if (!Dom.hasClass('componentTR', 'hidden')) {
+ Dom.addClass('componentTR', 'hidden');
+ bugForm.toggleOddEven();
+ }
+ } else {
+ if (Dom.hasClass('componentTR', 'hidden')) {
+ Dom.removeClass('componentTR', 'hidden');
+ bugForm.toggleOddEven();
+ }
+ }
+
if (this._loaded == productName)
return;
@@ -548,7 +561,7 @@ var dupes = {
var bugForm = {
_visibleHelpPanel: null,
- _mandatoryFields: [ 'short_desc', 'component_select', 'version_select' ],
+ _mandatoryFields: [],
onInit: function() {
Dom.get('user_agent').value = navigator.userAgent;
@@ -602,38 +615,59 @@ var bugForm = {
// build components
- // check for a general component
- var defaultComponent = false;
- for (var i = 0, n = product.details.components.length; i < n; i++) {
- var component = product.details.components[i];
- if (component.is_active == '1') {
- if (component.name.match(/general/i)) {
- defaultComponent = component.name;
- break;
+ var elComponent = Dom.get('component');
+ if (products[productName].noComponentSelection) {
+
+ elComponent.value = products[productName].defaultComponent;
+ bugForm._mandatoryFields = [ 'short_desc', 'version_select' ];
+
+ } else {
+
+ bugForm._mandatoryFields = [ 'short_desc', 'component_select', 'version_select' ];
+
+ // check for the default component
+ var defaultRegex = products[productName].defaultComponent
+ ? new RegExp('^' + products[productName].defaultComponent + '$', 'i')
+ : new RegExp('General', 'i');
+ var preselectedComponent = false;
+ for (var i = 0, n = product.details.components.length; i < n; i++) {
+ var component = product.details.components[i];
+ if (component.is_active == '1') {
+ if (defaultRegex.test(component.name)) {
+ preselectedComponent = component.name;
+ break;
+ }
}
}
- }
- // if there isn't a default component, default to blank
- if (!defaultComponent) {
- elComponents.options[elComponents.options.length] = new Option('', '');
- }
+ // if there isn't a default component, default to blank
+ if (!preselectedComponent) {
+ elComponents.options[elComponents.options.length] = new Option('', '');
+ }
- // build component select
- for (var i = 0, n = product.details.components.length; i < n; i++) {
- var component = product.details.components[i];
- if (component.is_active == '1') {
- elComponents.options[elComponents.options.length] =
- new Option(component.name, component.name);
+ // build component select
+ for (var i = 0, n = product.details.components.length; i < n; i++) {
+ var component = product.details.components[i];
+ if (component.is_active == '1') {
+ elComponents.options[elComponents.options.length] =
+ new Option(component.name, component.name);
+ }
+ }
+
+ var validComponent = false;
+ for (var i = 0, n = elComponents.options.length; i < n && !validComponent; i++) {
+ if (elComponents.options[i].value == elComponent.value)
+ validComponent = true;
+ }
+ if (!validComponent)
+ elComponent.value = '';
+ if (elComponent.value == '' && preselectedComponent)
+ elComponent.value = preselectedComponent;
+ if (elComponent.value != '') {
+ elComponents.value = elComponent.value;
+ this.onComponentChange(elComponent.value);
}
- }
- var elComponent = Dom.get('component');
- if (elComponent.value == '' && defaultComponent)
- elComponent.value = defaultComponent;
- if (elComponent.value != '') {
- elComponents.value = elComponent.value;
- this.onComponentChange(elComponent.value);
}
// build versions
@@ -741,6 +775,18 @@ var bugForm = {
return false;
},
+ toggleOddEven: function() {
+ var rows = Dom.get('bugForm').getElementsByTagName('TR');
+ var doToggle = false;
+ for (var i = 0, n = rows.length; i < n; i++) {
+ if (doToggle) {
+ rows[i].className = rows[i].className == 'odd' ? 'even' : 'odd';
+ } else {
+ doToggle = rows[i].id == 'componentTR';
+ }
+ }
+ },
+
_getFilename: function() {
var filename = Dom.get('data').value;
if (!filename)
diff --git a/extensions/GuidedBugEntry/web/js/products.js b/extensions/GuidedBugEntry/web/js/products.js
index c6fc25e75..35799b74f 100644
--- a/extensions/GuidedBugEntry/web/js/products.js
+++ b/extensions/GuidedBugEntry/web/js/products.js
@@ -29,8 +29,11 @@
* version: function which returns a version (eg. detected from UserAgent)
* support: string which is displayed at the top of the duplicates page
* secgroup: the group to place confidential bugs into
+ * defaultComponent: the default compoent to select. Defaults to 'General'
+ * noComponentSelection: when true, the default component will always be
+ * used. Defaults to 'false';
* detectPlatform: when true the platform and op_sys will be set from the
- * browser's user agent. when false, these will be set to All
+ * browser's user agent. when false, these will be set to All
*/
var products = {
@@ -52,6 +55,8 @@ var products = {
return false;
}
},
+ defaultComponent: "Untriaged",
+ noComponentSelection: true,
detectPlatform: true,
support:
'If you are new to Firefox or Bugzilla, please consider checking ' +