Skip to content

Commit 2344279

Browse files
committed
Bug 1050226 - Offer web devs a more focused set of product/components to file bugs in
1 parent 1ccc683 commit 2344279

5 files changed

Lines changed: 93 additions & 52 deletions

File tree

12.2 KB
Loading

extensions/GuidedBugEntry/Extension.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ sub _init_vars {
9797

9898
$vars->{'platform'} = detect_platform();
9999
$vars->{'op_sys'} = detect_op_sys();
100+
$vars->{'webdev'} = Bugzilla->cgi->param('webdev');
100101
}
101102

102103
sub page_before_template {
@@ -117,6 +118,7 @@ sub page_before_template {
117118
}
118119
}
119120
$vars->{'create_bug_formats'} = \%bug_formats;
121+
$vars->{'webdev'} = Bugzilla->cgi->param('webdev');
120122
}
121123

122124
__PACKAGE__->NAME;

extensions/GuidedBugEntry/template/en/default/guided/guided.html.tmpl

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ YAHOO.util.Dom.removeClass('loading', 'hidden');
3838
</script>
3939

4040
<div id="steps">
41+
[% INCLUDE webdev_step %]
4142
[% INCLUDE product_step %]
4243
[% INCLUDE otherProducts_step %]
4344
[% INCLUDE dupes_step %]
@@ -52,7 +53,7 @@ YAHOO.util.Dom.removeClass('loading', 'hidden');
5253

5354
<script type="text/javascript">
5455
YAHOO.util.Dom.addClass('loading', 'hidden');
55-
guided.init();
56+
guided.init({ webdev: [% webdev ? "true" : "false" %] });
5657
guided.detectedPlatform = '[% platform FILTER js %]';
5758
guided.detectedOpSys = '[% op_sys FILTER js %]';
5859
guided.currentUser = '[% user.login FILTER js %]';
@@ -81,20 +82,52 @@ dupes.setLabels(
8182
[% BLOCK page_title %]
8283
<div id="page_title">
8384
<h2>Enter A [% terms.Bug %]</h2>
84-
<h3>Step [% step_number FILTER html %] of 3</h3>
8585
</div>
8686
[% END %]
8787

88+
[%############################################################################%]
89+
[%# webdev step #%]
90+
[%############################################################################%]
91+
92+
[% BLOCK webdev_step %]
93+
<div id="webdev_step" class="step hidden">
94+
95+
[% INCLUDE page_title %]
96+
97+
<p>Are you reporting a [% terms.bug %] with:</p>
98+
99+
<ul class="product-list">
100+
[% WRAPPER product_block
101+
icon="component.png"
102+
onclick="product.select('Core', 'Untriaged')" %]
103+
HTML, CSS, JS, SVG, or some other web technology or combination of
104+
web technologies?
105+
[% END %]
106+
107+
[% WRAPPER product_block
108+
icon="devedition.png"
109+
onclick="product.select('Firefox', 'Developer Tools')" %]
110+
Firefox's developer tools
111+
[% END %]
112+
113+
[% WRAPPER product_block
114+
icon="firefox.png"
115+
onclick="product.select('Firefox', 'Untriaged')" %]
116+
Firefox's user interface (for example, an issue with bookmarks,
117+
tabbed browsing or the location bar)
118+
[% END %]
119+
</ul>
120+
</div>
121+
[% END %]
122+
88123
[%############################################################################%]
89124
[%# product step #%]
90125
[%############################################################################%]
91126

92127
[% BLOCK product_step %]
93128
<div id="product_step" class="step hidden">
94129

95-
[% INCLUDE page_title
96-
step_number = "1"
97-
%]
130+
[% INCLUDE page_title %]
98131

99132
[% INCLUDE exits
100133
show = "all"
@@ -160,9 +193,7 @@ Other Mozilla products which aren't listed here
160193
[% BLOCK otherProducts_step %]
161194
<div id="otherProducts_step" class="step hidden">
162195

163-
[% INCLUDE page_title
164-
step_number = "1"
165-
%]
196+
[% INCLUDE page_title %]
166197

167198
[% INCLUDE exits
168199
show = "all"
@@ -238,7 +269,8 @@ Other Mozilla products which aren't listed here
238269
</div>
239270
</td>
240271
<td class="exit_text_last">
241-
<a href="enter_bug.cgi?format=guided&amp;product=Core">Report an issue with Firefox on a site that I've developed</a><br>
272+
273+
<a onclick="product.select('Core', 'Untriaged')" href="javascript:void(0)">Report an issue with Firefox on a site that I've developed</a><br>
242274
<a href="http://input.mozilla.org/feedback/#sad">Report an issue with a web site that I use</a><br>
243275
</td>
244276
</tr>
@@ -249,38 +281,18 @@ Other Mozilla products which aren't listed here
249281
</h3>
250282
[% END %]
251283

252-
[% BLOCK exit_block %]
253-
<tr>
254-
<td>
255-
<div class="exit_img">
256-
<a href="[% href FILTER none %]"
257-
><img src="extensions/GuidedBugEntry/web/images/[% icon FILTER uri %]" width="32" height="32"
258-
></a>
259-
</div>
260-
</td>
261-
<td width="100%">
262-
<h2>
263-
<a href="[% href FILTER none %]">[% name FILTER html %]</a>
264-
</h2>
265-
[% desc FILTER html %]
266-
</td>
267-
</tr>
268-
[% END %]
269-
270284
[%############################################################################%]
271285
[%# duplicates step #%]
272286
[%############################################################################%]
273287

274288
[% BLOCK dupes_step %]
275289
<div id="dupes_step" class="step hidden">
276290

277-
[% INCLUDE page_title
278-
step_number = "2"
279-
%]
291+
[% INCLUDE page_title %]
280292

281293
<p>
282294
Product: <b><span id="dupes_product_name">?</span></b>:
283-
(<a href="javascript:void(0)" onclick="guided.setStep('product')">Change</a>)
295+
(<a href="javascript:void(0)" onclick="guided.setStep('default')">Change</a>)
284296
</p>
285297

286298
<table border="0" cellpadding="5" cellspacing="0" id="product_support" class="hidden">
@@ -329,9 +341,7 @@ Product: <b><span id="dupes_product_name">?</span></b>:
329341
[% BLOCK bugForm_step %]
330342
<div id="bugForm_step" class="step hidden">
331343

332-
[% INCLUDE page_title
333-
step_number = "3"
334-
%]
344+
[% INCLUDE page_title %]
335345

336346
<form method="post" action="post_bug.cgi" enctype="multipart/form-data" onsubmit="return bugForm.validate()">
337347
<input type="hidden" name="token" value="[% token FILTER html %]">
@@ -376,7 +386,7 @@ explain how to write effective [% terms.bug %] reports.</li>
376386
<td class="label">Product:</td>
377387
<td id="productTD">
378388
<span id="product_label"></span>
379-
(<a href="javascript:void(0)" onclick="guided.setStep('product')">Change</a>)
389+
(<a href="javascript:void(0)" onclick="guided.setStep('default')">Change</a>)
380390
</td>
381391
<td id="versionTD" class="hidden">
382392
<span class="label">Version:
@@ -477,7 +487,7 @@ explain how to write effective [% terms.bug %] reports.</li>
477487
</div>
478488
</td>
479489
</tr>
480-
<tr>
490+
<tr id="data_description_tr">
481491
<td class="label">File Description:</td>
482492
<td colspan="2"><input type="text" name="description" id="data_description" class="textInput" disabled></td>
483493
<td>&nbsp;</td>

extensions/GuidedBugEntry/web/js/guided.js

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var History = YAHOO.util.History;
1313

1414
var guided = {
1515
_currentStep: '',
16+
_defaultStep: 'product',
1617
detectedPlatform: '',
1718
detectedOpSys: '',
1819
currentUser: '',
@@ -23,6 +24,9 @@ var guided = {
2324
// initialise new step
2425
this.updateStep = true;
2526
switch(newStep) {
27+
case 'webdev':
28+
webdev.onShow();
29+
break;
2630
case 'product':
2731
product.onShow();
2832
break;
@@ -36,7 +40,7 @@ var guided = {
3640
bugForm.onShow();
3741
break;
3842
default:
39-
guided.setStep('product');
43+
guided.setStep(this._defaultStep);
4044
return;
4145
}
4246

@@ -60,11 +64,14 @@ var guided = {
6064
}
6165
},
6266

63-
init: function() {
67+
init: function(conf) {
6468
// init history manager
69+
if (conf.webdev) {
70+
this._defaultStep = 'webdev';
71+
this.webdev = true;
72+
}
6573
try {
66-
History.register('h', History.getBookmarkedState('h') || 'product',
67-
this._onStateChange);
74+
History.register('h', History.getBookmarkedState('h') || this._defaultStep, this._onStateChange);
6875
History.initialize("yui-history-field", "yui-history-iframe");
6976
History.onReady(function () {
7077
guided._onStateChange(History.getCurrentState('h'), true);
@@ -74,6 +81,7 @@ var guided = {
7481
}
7582

7683
// init steps
84+
webdev.onInit();
7785
product.onInit();
7886
dupes.onInit();
7987
bugForm.onInit();
@@ -95,6 +103,16 @@ var guided = {
95103
}
96104
};
97105

106+
// webdev step
107+
108+
var webdev = {
109+
details: false,
110+
111+
onInit: function () { },
112+
113+
onShow: function () { }
114+
};
115+
98116
// product step
99117

100118
var product = {
@@ -109,8 +127,22 @@ var product = {
109127
Dom.removeClass('advanced', 'hidden');
110128
},
111129

112-
select: function(productName) {
130+
select: function(productName, componentName) {
131+
var prod = products[productName];
132+
113133
// called when a product is selected
134+
if (componentName) {
135+
this.setPreselectedComponent(componentName);
136+
if (prod && prod.defaultComponent) {
137+
prod.originalDefaultComponent = prod.originalDefaultComponent || prod.defaultComponent;
138+
prod.defaultComponent = componentName;
139+
}
140+
}
141+
else {
142+
if (prod && prod.defaultComponent && prod.originalDefaultComponent) {
143+
prod.defaultComponent = prod.originalDefaultComponent;
144+
}
145+
}
114146
this.setName(productName);
115147
dupes.reset();
116148
guided.setStep('dupes');
@@ -184,7 +216,7 @@ var product = {
184216
}
185217

186218
// show/hide component selection row
187-
if (products[productName] && products[productName].noComponentSelection) {
219+
if (products[productName] && products[productName].noComponentSelection || guided.webdev) {
188220
if (!Dom.hasClass('componentTR', 'hidden')) {
189221
Dom.addClass('componentTR', 'hidden');
190222
}
@@ -468,7 +500,7 @@ var dupes = {
468500
// a search has happened
469501
Dom.addClass('advanced', 'hidden');
470502
Dom.addClass('dupes_continue_button_top', 'hidden');
471-
var prod = product.getName();
503+
var prod = product.getName();
472504
if (products[prod] && products[prod].l10n) {
473505
Dom.removeClass('l10n_message', 'hidden');
474506
Dom.get('l10n_product').textContent = product.getName();
@@ -682,13 +714,10 @@ var bugForm = {
682714
// build components
683715

684716
var elComponent = Dom.get('component');
685-
if (products[productName] && products[productName].noComponentSelection) {
686-
717+
if (products[productName] && products[productName].noComponentSelection || guided.webdev) {
687718
elComponent.value = products[productName].defaultComponent;
688719
bugForm._mandatoryFields = [ 'short_desc', 'version_select' ];
689-
690720
} else {
691-
692721
bugForm._mandatoryFields = [ 'short_desc', 'component_select', 'version_select' ];
693722

694723
// check for the default component
@@ -836,10 +865,14 @@ var bugForm = {
836865
elReset.disabled = false;
837866
elDescription.value = filename;
838867
elDescription.disabled = false;
868+
Dom.removeClass('reset_data', 'hidden');
869+
Dom.removeClass('data_description_tr', 'hidden');
839870
} else {
840871
elReset.disabled = true;
841872
elDescription.value = '';
842873
elDescription.disabled = true;
874+
Dom.addClass('reset_data', 'hidden');
875+
Dom.addClass('data_description_tr', 'hidden');
843876
}
844877
},
845878

extensions/GuidedBugEntry/web/style/guided.css

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,10 @@ ul.product-list > li > .product-item {
207207
padding: 5px;
208208
}
209209

210-
#bugForm tr:nth-child(even) td, #bugForm tr:nth-child(even) th {
210+
#bugForm tr {
211211
background: #e0e0e0;
212212
}
213213

214-
#bugForm tr.odd td {
215-
background: inherit;
216-
}
217-
218214
#bugForm .label {
219215
text-align: left;
220216
font-weight: bold;

0 commit comments

Comments
 (0)