Commit 475abdfc authored by Max Kanat-Alexander's avatar Max Kanat-Alexander

Bug 555850: Make fields.html help on enter_bug happen when the user hovers

over the fields r=timello, a=mkanat
parent d3259eeb
...@@ -534,38 +534,40 @@ if ( Bugzilla->params->{'usetargetmilestone'} ) { ...@@ -534,38 +534,40 @@ if ( Bugzilla->params->{'usetargetmilestone'} ) {
} }
# Construct the list of allowable statuses. # Construct the list of allowable statuses.
my $initial_statuses = Bugzilla::Status->can_change_to(); my @statuses = @{ Bugzilla::Status->can_change_to() };
# Exclude closed states from the UI, even if the workflow allows them. # Exclude closed states from the UI, even if the workflow allows them.
# The back-end code will still accept them, though. # The back-end code will still accept them, though.
@$initial_statuses = grep { $_->is_open } @$initial_statuses; @statuses = grep { $_->is_open } @statuses;
my @status = map { $_->name } @$initial_statuses;
# UNCONFIRMED is illegal if allows_unconfirmed is false. # UNCONFIRMED is illegal if allows_unconfirmed is false.
if (!$product->allows_unconfirmed) { if (!$product->allows_unconfirmed) {
@status = grep {$_ ne 'UNCONFIRMED'} @status; @statuses = grep { $_->name ne 'UNCONFIRMED' } @statuses;
} }
scalar(@status) || ThrowUserError('no_initial_bug_status'); scalar(@statuses) || ThrowUserError('no_initial_bug_status');
# If the user has no privs... # If the user has no privs...
unless ($has_editbugs || $has_canconfirm) { unless ($has_editbugs || $has_canconfirm) {
# ... use UNCONFIRMED if available, else use the first status of the list. # ... use UNCONFIRMED if available, else use the first status of the list.
my $bug_status = (grep {$_ eq 'UNCONFIRMED'} @status) ? 'UNCONFIRMED' : $status[0]; my $bug_status = (grep { $_->name eq 'UNCONFIRMED' } @statuses)
@status = ($bug_status); ? 'UNCONFIRMED' : $statuses[0]->name;
@statuses = ($bug_status);
} }
$vars->{'bug_status'} = \@status; $vars->{'bug_status'} = \@statuses;
# Get the default from a template value if it is legitimate. # Get the default from a template value if it is legitimate.
# Otherwise, and only if the user has privs, set the default # Otherwise, and only if the user has privs, set the default
# to the first confirmed bug status on the list, if available. # to the first confirmed bug status on the list, if available.
if (formvalue('bug_status') && grep { $_ eq formvalue('bug_status') } @status) { my $picked_status = formvalue('bug_status');
if ($picked_status and grep($_->name eq $picked_status, @statuses)) {
$default{'bug_status'} = formvalue('bug_status'); $default{'bug_status'} = formvalue('bug_status');
} elsif (scalar @status == 1) { } elsif (scalar @statuses == 1) {
$default{'bug_status'} = $status[0]; $default{'bug_status'} = $statuses[0]->name;
} }
else { else {
$default{'bug_status'} = ($status[0] ne 'UNCONFIRMED') ? $status[0] : $status[1]; $default{'bug_status'} = ($statuses[0]->name ne 'UNCONFIRMED')
? $statuses[0]->name : $statuses[1]->name;
} }
my @groups = $cgi->param('groups'); my @groups = $cgi->param('groups');
......
...@@ -463,6 +463,9 @@ div.user_match { ...@@ -463,6 +463,9 @@ div.user_match {
vertical-align: top; vertical-align: top;
font-weight: bold; font-weight: bold;
} }
.field_help_link {
cursor: help;
}
.field_value, form#Create th, form#Create td { .field_value, form#Create th, form#Create td {
vertical-align: top; vertical-align: top;
} }
......
...@@ -214,10 +214,13 @@ TUI_hide_default('expert_fields'); ...@@ -214,10 +214,13 @@ TUI_hide_default('expert_fields');
[%# We can't use the select block in these two cases for various reasons. %] [%# We can't use the select block in these two cases for various reasons. %]
<tr> <tr>
<th class="required"> [% component_desc_url = BLOCK -%]
<a href="describecomponents.cgi?product=[% product.name FILTER url_quote %]"> describecomponents.cgi?product=[% product.name FILTER url_quote %]
Component</a>: [% END %]
</th> [% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.component editable = 1 required = 1
desc_url = component_desc_url
%]
<td id="field_container_component"> <td id="field_container_component">
<select name="component" id="component" onchange="set_assign_to();" <select name="component" id="component" onchange="set_assign_to();"
size="7" aria-required="true" class="required"> size="7" aria-required="true" class="required">
...@@ -272,8 +275,9 @@ TUI_hide_default('expert_fields'); ...@@ -272,8 +275,9 @@ TUI_hide_default('expert_fields');
</tr> </tr>
<tr> <tr>
<th rowspan="3"><a href="page.cgi?id=fields.html#version"> [% INCLUDE "bug/field-label.html.tmpl"
[%- field_descs.version FILTER html %]:</a></th> field = bug_fields.version editable = 1 rowspan = 3
%]
<td rowspan="3"> <td rowspan="3">
<select name="version" size="5"> <select name="version" size="5">
[%- FOREACH v = version %] [%- FOREACH v = version %]
...@@ -321,8 +325,7 @@ TUI_hide_default('expert_fields'); ...@@ -321,8 +325,7 @@ TUI_hide_default('expert_fields');
<tbody class="expert_fields"> <tbody class="expert_fields">
<tr> <tr>
[% IF Param('usetargetmilestone') && Param('letsubmitterchoosemilestone') %] [% IF Param('usetargetmilestone') && Param('letsubmitterchoosemilestone') %]
[% sel = { description => 'Target Milestone', name => 'target_milestone' } %] [% INCLUDE select field = bug_fields.target_milestone %]
[% INCLUDE select %]
[% ELSE %] [% ELSE %]
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
[% END %] [% END %]
...@@ -343,15 +346,10 @@ TUI_hide_default('expert_fields'); ...@@ -343,15 +346,10 @@ TUI_hide_default('expert_fields');
</tr> </tr>
<tr> <tr>
[% IF bug_status.size <= 1 %] [% INCLUDE bug/field.html.tmpl
<input type="hidden" name="bug_status" bug = default, field = bug_fields.bug_status,
value="[% default.bug_status FILTER html %]"> editable = (bug_status.size > 1), value = default.bug_status
<th>Initial State:</th> override_legal_values = bug_status %]
<td>[% display_value("bug_status", default.bug_status) FILTER html %]</td>
[% ELSE %]
[% sel = { description => 'Initial State', name => 'bug_status' } %]
[% INCLUDE select %]
[% END %]
<td>&nbsp;</td> <td>&nbsp;</td>
[%# Calculate the number of rows we can use for flags %] [%# Calculate the number of rows we can use for flags %]
...@@ -382,7 +380,9 @@ TUI_hide_default('expert_fields'); ...@@ -382,7 +380,9 @@ TUI_hide_default('expert_fields');
</tr> </tr>
<tr> <tr>
<th><a href="page.cgi?id=fields.html#assigned_to">Assign To</a>:</th> [% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.assigned_to editable = 1
%]
<td colspan="2"> <td colspan="2">
[% INCLUDE global/userselect.html.tmpl [% INCLUDE global/userselect.html.tmpl
id => "assigned_to" id => "assigned_to"
...@@ -399,8 +399,9 @@ TUI_hide_default('expert_fields'); ...@@ -399,8 +399,9 @@ TUI_hide_default('expert_fields');
[% IF Param("useqacontact") %] [% IF Param("useqacontact") %]
<tr> <tr>
<th><a href="page.cgi?id=fields.html#qa_contact"> [% INCLUDE "bug/field-label.html.tmpl"
[%- field_descs.qa_contact FILTER html %]:</a></th> field = bug_fields.qa_contact editable = 1
%]
<td colspan="2"> <td colspan="2">
[% INCLUDE global/userselect.html.tmpl [% INCLUDE global/userselect.html.tmpl
id => "qa_contact" id => "qa_contact"
...@@ -417,8 +418,9 @@ TUI_hide_default('expert_fields'); ...@@ -417,8 +418,9 @@ TUI_hide_default('expert_fields');
[% END %] [% END %]
<tr> <tr>
<th><a href="page.cgi?id=fields.html#cc"> [% INCLUDE "bug/field-label.html.tmpl"
[%- field_descs.cc FILTER html %]:</a></th> field = bug_fields.cc editable = 1
%]
<td colspan="2"> <td colspan="2">
[% INCLUDE global/userselect.html.tmpl [% INCLUDE global/userselect.html.tmpl
id => "cc" id => "cc"
...@@ -445,8 +447,9 @@ TUI_hide_default('expert_fields'); ...@@ -445,8 +447,9 @@ TUI_hide_default('expert_fields');
[% IF user.is_timetracker %] [% IF user.is_timetracker %]
<tr> <tr>
<th><a href="page.cgi?id=fields.html#estimated_time">Estimated [% INCLUDE "bug/field-label.html.tmpl"
Hours:</a></th> field = bug_fields.estimated_time editable = 1
%]
<td colspan="2"> <td colspan="2">
<input name="estimated_time" size="6" maxlength="6" value="[% estimated_time FILTER html %]"> <input name="estimated_time" size="6" maxlength="6" value="[% estimated_time FILTER html %]">
</td> </td>
...@@ -464,8 +467,9 @@ TUI_hide_default('expert_fields'); ...@@ -464,8 +467,9 @@ TUI_hide_default('expert_fields');
[% IF Param("usebugaliases") %] [% IF Param("usebugaliases") %]
<tr> <tr>
<th><a href="page.cgi?id=fields.html#alias"> [% INCLUDE "bug/field-label.html.tmpl"
[%- field_descs.alias FILTER html %]:</a></th> field = bug_fields.alias editable = 1
%]
<td colspan="2"> <td colspan="2">
<input name="alias" size="20" value="[% alias FILTER html %]"> <input name="alias" size="20" value="[% alias FILTER html %]">
</td> </td>
...@@ -473,8 +477,9 @@ TUI_hide_default('expert_fields'); ...@@ -473,8 +477,9 @@ TUI_hide_default('expert_fields');
[% END %] [% END %]
<tr> <tr>
<th><a href="page.cgi?id=fields.html#bug_file_loc"> [% INCLUDE "bug/field-label.html.tmpl"
[%- field_descs.bug_file_loc FILTER html %]:</a></th> field = bug_fields.bug_file_loc editable = 1
%]
<td colspan="2"> <td colspan="2">
<input name="bug_file_loc" size="40" <input name="bug_file_loc" size="40"
value="[% bug_file_loc FILTER html %]"> value="[% bug_file_loc FILTER html %]">
...@@ -499,8 +504,9 @@ TUI_hide_default('expert_fields'); ...@@ -499,8 +504,9 @@ TUI_hide_default('expert_fields');
<tbody> <tbody>
<tr> <tr>
<th class="required"><a href="page.cgi?id=fields.html#short_desc"> [% INCLUDE "bug/field-label.html.tmpl"
[%- field_descs.short_desc FILTER html %]:</a></th> field = bug_fields.short_desc editable = 1 required = 1
%]
<td colspan="3"> <td colspan="3">
<input name="short_desc" size="70" value="[% short_desc FILTER html %]" <input name="short_desc" size="70" value="[% short_desc FILTER html %]"
maxlength="255" spellcheck="true" aria-required="true" maxlength="255" spellcheck="true" aria-required="true"
...@@ -590,7 +596,10 @@ TUI_hide_default('expert_fields'); ...@@ -590,7 +596,10 @@ TUI_hide_default('expert_fields');
[% IF user.in_group('editbugs', product.id) %] [% IF user.in_group('editbugs', product.id) %]
[% IF use_keywords %] [% IF use_keywords %]
<tr> <tr>
<th><a href="describekeywords.cgi">Keywords</a>:</th> [% INCLUDE "bug/field-label.html.tmpl"
field = bug_fields.keywords editable = 1
desc_url = "describekeywords.cgi"
%]
<td colspan="3"> <td colspan="3">
<input id="keywords" name="keywords" size="40" <input id="keywords" name="keywords" size="40"
value="[% keywords FILTER html %]"> (optional) value="[% keywords FILTER html %]"> (optional)
...@@ -599,15 +608,17 @@ TUI_hide_default('expert_fields'); ...@@ -599,15 +608,17 @@ TUI_hide_default('expert_fields');
[% END %] [% END %]
<tr> <tr>
<th><a href="page.cgi?id=fields.html#dependson"> [% INCLUDE "bug/field-label.html.tmpl"
[%- field_descs.dependson FILTER html %]:</a></th> field = bug_fields.dependson editable = 1
%]
<td colspan="3"> <td colspan="3">
<input name="dependson" accesskey="d" value="[% dependson FILTER html %]"> <input name="dependson" accesskey="d" value="[% dependson FILTER html %]">
</td> </td>
</tr> </tr>
<tr> <tr>
<th><a href="page.cgi?id=fields.html#blocked"> [% INCLUDE "bug/field-label.html.tmpl"
[%- field_descs.blocked FILTER html %]:</a></th> field = bug_fields.blocked editable = 1
%]
<td colspan="3"> <td colspan="3">
<input name="blocked" accesskey="b" value="[% blocked FILTER html %]"> <input name="blocked" accesskey="b" value="[% blocked FILTER html %]">
</td> </td>
...@@ -678,30 +689,20 @@ TUI_hide_default('expert_fields'); ...@@ -678,30 +689,20 @@ TUI_hide_default('expert_fields');
[%############################################################################%] [%############################################################################%]
[% BLOCK select %] [% BLOCK select %]
[% IF sel.description %]
<th>
<a href="page.cgi?id=fields.html#[% sel.name %]">[% sel.description %]</a>:
</th>
[% END %]
[% INCLUDE "bug/field-label.html.tmpl"
field = field editable = 1
%]
<td> <td>
<select name="[% sel.name %]" id="[% sel.name %]"> <select name="[% field.name FILTER html %]"
[%- FOREACH x = ${sel.name} %] id="[% field.name FILTER html %]">
[%- FOREACH x = ${field.name} %]
<option value="[% x FILTER html %]" <option value="[% x FILTER html %]"
[% " selected=\"selected\"" IF x == default.${sel.name} %]> [% " selected=\"selected\"" IF x == default.${field.name} %]>
[% display_value(sel.name, x) FILTER html %] [% display_value(field.name, x) FILTER html %]
</option> </option>
[% END %] [% END %]
</select> </select>
[% IF sel.name == "bug_status" %]
<script type="text/javascript">
<!--
[%+ INCLUDE "bug/field-events.js.tmpl"
field = bug_fields.bug_status %]
//-->
</script>
[% END %]
</td> </td>
[% END %] [% END %]
......
...@@ -149,8 +149,8 @@ status_whiteboard => ...@@ -149,8 +149,8 @@ status_whiteboard =>
_ " adding tags and status information.", _ " adding tags and status information.",
target_milestone => target_milestone =>
"The target_milestone field is used to define when the engineer" "The $field_descs.target_milestone field is used to define when the"
_ " the $terms.bug is assigned to expects to fix it.", _ " engineer the $terms.bug is assigned to expects to fix it.",
version => version =>
"The version field defines the version of the software the" "The version field defines the version of the software the"
...@@ -215,6 +215,19 @@ email1 => ...@@ -215,6 +215,19 @@ email1 =>
[% END %] [% END %]
[% FOREACH help_field = bug_fields.keys %] [% FOREACH help_field = bug_fields.keys %]
[%# Add help for custom fields. %]
[% IF !help_html.${help_field}.defined %]
[% SET field_type = bug_fields.${help_field}.type %]
[% field_type_desc = BLOCK -%]
[% field_types.$field_type FILTER html %]
[%- END %]
[% help_html.${help_field} =
"A custom $field_type_desc field in this installation"
_ " of ${terms.Bugzilla}." %]
[% END %]
[%# Add help for the search types, for query.cgi. %]
[% type_desc = BLOCK %] [% type_desc = BLOCK %]
The type of [% field_descs.${help_field} FILTER html %] search you The type of [% field_descs.${help_field} FILTER html %] search you
would like. would like.
......
[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Everything Solved, Inc.
# Portions created by the Initial Developer are Copyright (C) 2010 the
# Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Max Kanat-Alexander <mkanat@bugzilla.org>
#%]
[%# INTERFACE:
# field: a Bugzilla::Field object
# desc_url: An alternate link to help for the field.
# hidden: True if the field label should start hidden.
# required: True if this field must have a value.
# rowspan: a "rowspan" value for the label's <th>.
#%]
[% PROCESS "bug/field-help.none.tmpl" %]
<th class="field_label [% ' bz_hidden_field' IF hidden %]
[%- ' required' IF required %]"
id="field_label_[% field.name FILTER html %]"
[% IF rowspan %] rowspan="[% rowspan FILTER html %]"[% END %]>
[% IF editable %]
<label for="[% field.name FILTER html %]">
[% END %]
<a
[% IF help_html.${field.name}.defined %]
title="[% help_html.${field.name} FILTER txt FILTER collapse FILTER html %]"
class="field_help_link"
[% END %]
[% IF desc_url %]
href="[% desc_url FILTER html %]"
[% ELSE %]
href="page.cgi?id=fields.html#[% field.name FILTER url_quote %]"
[% END %]
>[%- field_descs.${field.name} FILTER html %]:</a>
[% '</label>' IF editable %]
</th>
...@@ -47,19 +47,7 @@ ...@@ -47,19 +47,7 @@
[% END %] [% END %]
[% IF NOT no_tds %] [% IF NOT no_tds %]
<th class="field_label [% ' bz_hidden_field' IF hidden %]" [% PROCESS "bug/field-label.html.tmpl" %]
id="field_label_[% field.name FILTER html %]">
[% IF editable %]
<label for="[% field.name FILTER html %]">
[% END %]
[% IF desc_url %]
<a href="[% desc_url FILTER html %]">
[% ELSE %]
<a href="page.cgi?id=fields.html#[% field.name FILTER url_quote %]">
[% END %]
[%- field_descs.${field.name} FILTER html %]:</a>
[% '</label>' IF editable %]
</th>
[% END %] [% END %]
[% IF NOT no_tds %] [% IF NOT no_tds %]
......
...@@ -316,8 +316,6 @@ ...@@ -316,8 +316,6 @@
], ],
'bug/create/create.html.tmpl' => [ 'bug/create/create.html.tmpl' => [
'sel.name',
'sel.description',
'cloned_bug_id', 'cloned_bug_id',
], ],
......
...@@ -267,12 +267,7 @@ ...@@ -267,12 +267,7 @@
<dt id="[% field FILTER html %]">[% field_desc FILTER html %]</dt> <dt id="[% field FILTER html %]">[% field_desc FILTER html %]</dt>
<dd> <dd>
[% SET help_text = field_help_map.${field_desc}.help %] [% SET help_text = field_help_map.${field_desc}.help %]
[% IF help_text %] [% help_text FILTER none %]
[% help_text FILTER none %]
[% ELSE %]
A custom [% field_types.${field_object.type} FILTER html %] field in
this installation of [% terms.Bugzilla %].
[% END %]
</dd> </dd>
[% END %] [% END %]
</dl> </dl>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment