From d73a83506def7c6b43e5ad720777ec700f6af2e8 Mon Sep 17 00:00:00 2001 From: Jesse Clark Date: Sun, 7 Feb 2010 16:10:03 -0800 Subject: Bug 251556: Allow "Bug ID" fields to have one-way mutual relationships (like blocks/dependson) r=mkanat, a=mkanat --- .../en/default/admin/custom_fields/cf-js.js.tmpl | 10 ++++++ .../default/admin/custom_fields/create.html.tmpl | 37 ++++++++++++++++------ .../en/default/admin/custom_fields/edit.html.tmpl | 36 +++++++++++++++------ template/en/default/bug/edit.html.tmpl | 8 ++++- template/en/default/bug/field.html.tmpl | 23 +++++++++++--- template/en/default/bug/show-multiple.html.tmpl | 7 ++++ template/en/default/global/user-error.html.tmpl | 6 ++++ 7 files changed, 102 insertions(+), 25 deletions(-) (limited to 'template/en/default') diff --git a/template/en/default/admin/custom_fields/cf-js.js.tmpl b/template/en/default/admin/custom_fields/cf-js.js.tmpl index 778dd3373..4c95a1690 100644 --- a/template/en/default/admin/custom_fields/cf-js.js.tmpl +++ b/template/en/default/admin/custom_fields/cf-js.js.tmpl @@ -50,6 +50,16 @@ function onChangeType(type_field) { else { value_field.disabled = true; } + + var reverse_desc = document.getElementById('reverse_desc'); + if (type_field.value == [% constants.FIELD_TYPE_BUG_ID %]) + { + reverse_desc.disabled = false; + } + else { + reverse_desc.disabled = true; + reverse_desc.value = ''; + } } function onChangeVisibilityField() { diff --git a/template/en/default/admin/custom_fields/create.html.tmpl b/template/en/default/admin/custom_fields/create.html.tmpl index a2db4708b..d23be0fe2 100644 --- a/template/en/default/admin/custom_fields/create.html.tmpl +++ b/template/en/default/admin/custom_fields/create.html.tmpl @@ -28,8 +28,14 @@ onload = "document.getElementById('new_bugmail').disabled = true;" javascript_urls = [ 'js/util.js' ] doc_section = "custom-fields.html#add-custom-fields" + style_urls = ['skins/standard/admin.css'] %] +[%# set initial editability of fields such as Reverse Relationship Description %] + +

Adding custom fields can make the interface of [% terms.Bugzilla %] very complicated. Many admins who are new to [% terms.Bugzilla %] start off @@ -48,14 +54,14 @@

- +
- + - - + - - + - + - + - - + + - [% PROCESS bug/field.html.tmpl value=bug.${field.name} + [% PROCESS bug/field.html.tmpl value = bug.${field.name} editable = bug.check_can_change_field(field.name, 0, 1) value_span = 2 %] + [% IF extra_field_item %] + + + + + [% END %] [% END %] [% END %] diff --git a/template/en/default/bug/field.html.tmpl b/template/en/default/bug/field.html.tmpl index ac62bf7ba..482f88219 100644 --- a/template/en/default/bug/field.html.tmpl +++ b/template/en/default/bug/field.html.tmpl @@ -99,8 +99,8 @@ value="[% value FILTER html %]" size="7"> - [% IF bug.${field.name} %] - [% bug.${field.name} FILTER bug_link(bug.${field.name}) FILTER none %] + [% IF value %] + [% value FILTER bug_link(value, use_alias => 1) FILTER none %] [% END %] (edit) @@ -110,7 +110,7 @@ '[% field.name FILTER js %]_input_area', '[% field.name FILTER js %]_edit_action', '[% field.name FILTER js %]', - "[% bug.${field.name} FILTER js %]"); + "[% value FILTER js %]"); [% CASE [ constants.FIELD_TYPE_SINGLE_SELECT constants.FIELD_TYPE_MULTI_SELECT ] %] @@ -198,11 +198,24 @@
[% value FILTER wrap_comment(60) FILTER html %]
[% ELSIF field.type == constants.FIELD_TYPE_BUG_ID %] - [% IF bug.${field.name} %] - [% bug.${field.name} FILTER bug_link(bug.${field.name}) FILTER none %] + [% IF value %] + [% value FILTER bug_link(value, use_alias => 1) FILTER none %] [% END %] [% ELSE %] [% value.join(', ') FILTER html %] [% END %] [% Hook.process('end_field_column') %] [% '' IF NOT no_tds %] + +[%# for reverse relationships, we show this pseudo-field after the main field %] +[% IF bug.id && field.is_relationship %] + [% extra_field_item = {} %] + [% extra_field_item.header = field.reverse_desc _ ":" FILTER html %] + [% extra_field_item.data = BLOCK %] + [% FOREACH depbug = bug.related_bugs(field) %] + [% depbug.id FILTER bug_link(depbug, use_alias => 1) FILTER none %][% " " %] + [% END %] + [% END %] +[% ELSE %] + [% extra_field_item = '' %] +[% END %] diff --git a/template/en/default/bug/show-multiple.html.tmpl b/template/en/default/bug/show-multiple.html.tmpl index 177bea14f..0949ffc20 100644 --- a/template/en/default/bug/show-multiple.html.tmpl +++ b/template/en/default/bug/show-multiple.html.tmpl @@ -186,6 +186,13 @@ [% PROCESS bug/field.html.tmpl value=bug.${field.name} editable=0 %] [%# Even-numbered fields get a closing
%] [% '' IF !(field_counter % 2) %] + [% IF extra_field_item %] + [% field_counter = field_counter + 1 %] + [% '' IF field_counter % 2 %] + + + [% '' IF !(field_counter % 2) %] + [% END %] [% END %] [%# And we have to finish the row if we ended on an odd number. %] [% '' IF field_counter % 2 %] diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index eca7ef058..bdedc4172 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -1450,6 +1450,12 @@ To file this [% terms.bug %], you must first choose a component. If necessary, just guess. + [% ELSIF error == "relationship_loop_single" %] + [% title = "Relationship Loop Detected" %] + [% field_descs.$field_name FILTER html %] + for [% terms.bug %] [%+ bug_id FILTER html %] + has a circular dependency on [% terms.bug %] [%+ dep_id FILTER html %]. + [% ELSIF error == "require_new_password" %] [% title = "New Password Needed" %] You cannot change your password without choosing a new one. -- cgit v1.2.3-24-g4f1b
+ @@ -64,16 +70,16 @@
+
+ @@ -114,7 +120,18 @@
  + + + +
+ Use this label for the list of [% terms.bugs %] that link to a [% terms.bug %] + with this [% field_types.${constants.FIELD_TYPE_BUG_ID} %] field. + For example, if the description is "Is a duplicate of", + the reverse description would be "Duplicates of this [% terms.bug %]". + Leave blank to disable the list for this field. +
[% extra_field_item.header FILTER none %][% extra_field_item.data FILTER none %]
[% extra_field_item.header FILTER none %][% extra_field_item.data FILTER none %]