summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2008-02-08 06:56:31 +0100
committermkanat%bugzilla.org <>2008-02-08 06:56:31 +0100
commitfad558c794527a2c0bd32b378917be0fc27e453f (patch)
treef63b1d24514aeaa38c852f95d06728baf08dda53
parent1f0e11b9bbe5b880c488b214a45755792646f0b3 (diff)
downloadbugzilla-fad558c794527a2c0bd32b378917be0fc27e453f.tar.gz
bugzilla-fad558c794527a2c0bd32b378917be0fc27e453f.tar.xz
Bug 414284: Bug edit page is bad for changing components
Patch By Guy Pyrzak <guy.pyrzak@gmail.com> r=mkanat, a=mkanat
-rw-r--r--js/field.js77
-rw-r--r--template/en/default/bug/edit.html.tmpl10
2 files changed, 76 insertions, 11 deletions
diff --git a/js/field.js b/js/field.js
index 164ce1c31..4341a1543 100644
--- a/js/field.js
+++ b/js/field.js
@@ -176,18 +176,77 @@ function showEditableField (e, ContainerInputArray) {
*/
function checkForChangedFieldValues(e, ContainerInputArray ) {
var el = document.getElementById(ContainerInputArray[2]);
+ var unhide = false;
if ( el ) {
if ( el.value != ContainerInputArray[3] || ( el.value == "" && el.id != "alias") ) {
- YAHOO.util.Dom.setStyle(ContainerInputArray[0], 'display', 'none');
- YAHOO.util.Dom.setStyle(ContainerInputArray[1], 'display', 'inline');
- }
+ unhide = true;
+ }
+ else {
+ var set_default = document.getElementById("set_default_" + ContainerInputArray[2]);
+ if ( set_default ) {
+ if(set_default.checked){
+ unhide = true;
+ }
+ }
+ }
+ }
+ if(unhide){
+ YAHOO.util.Dom.setStyle(ContainerInputArray[0], 'display', 'none');
+ YAHOO.util.Dom.setStyle(ContainerInputArray[1], 'display', 'inline');
+ }
+
+}
+
+function hideAliasAndSummary(short_desc_value, alias_value) {
+ // check the short desc field
+ hideEditableField( 'summary_alias_container', 'summary_alias_input', 'editme_action', 'short_desc', short_desc_value);
+ // check that the alias hasn't changed
+ bz_alias_check_array = new Array('summary_alias_container', 'summary_alias_input', 'alias', alias_value )
+ YAHOO.util.Event.addListener( window, 'load', checkForChangedFieldValues, bz_alias_check_array);
+}
+
+function showPeopleOnChange( field_id_list ) {
+ for(var i = 0; i < field_id_list.length; i++) {
+ YAHOO.util.Event.addListener(field_id_list[i],'change', showEditableField, new Array('bz_qa_contact_edit_container', 'bz_qa_contact_input'));
+ YAHOO.util.Event.addListener(field_id_list[i],'change', showEditableField, new Array('bz_assignee_edit_container', 'bz_assignee_input'));
+ }
+}
+
+function assignToDefaultOnChange(field_id_list) {
+ showPeopleOnChange( field_id_list );
+ for(var i = 0; i < field_id_list.length; i++) {
+ YAHOO.util.Event.addListener(field_id_list[i],'change', setDefaultCheckbox, 'set_default_assignee' );
+ YAHOO.util.Event.addListener(field_id_list[i],'change', setDefaultCheckbox, 'set_default_qa_contact' );
+ }
+}
+
+function initAssignedQA(){
+ YAHOO.util.Event.addListener('set_default_qa_contact','change', boldOnChange, 'set_default_qa_contact');
+ YAHOO.util.Event.addListener('set_default_assignee','change', boldOnChange, 'set_default_assignee');
+ YAHOO.util.Event.addListener(window, 'load', checkForChangedFieldValues, new Array( 'bz_assignee_edit_container', 'bz_assignee_input', 'set_default_assignee', '' ) );
+ YAHOO.util.Event.addListener(window, 'load', checkForChangedFieldValues, new Array( 'bz_qa_contact_edit_container', 'bz_qa_contact_input', 'set_default_qa_contact', '' ) );
+ YAHOO.util.Event.addListener(window, 'load', boldOnChange, 'set_default_assignee');
+ YAHOO.util.Event.addListener(window, 'load', boldOnChange, 'set_default_qa_contact');
+}
+
+function setDefaultCheckbox(e, field_id ) {
+ var el = document.getElementById(field_id);
+ var elLabel = document.getElementById(field_id + "_label");
+ if( el && elLabel ) {
+ el.checked = "true";
+ YAHOO.util.Dom.setStyle(elLabel, 'font-weight', 'bold');
}
}
-function hideAliasAndSummary(short_desc_value, alias_value){
- // check the short desc field
- hideEditableField( 'summary_alias_container', 'summary_alias_input', 'editme_action', 'short_desc', short_desc_value);
- // check that the alias hasn't changed
- bz_alias_check_array = new Array('summary_alias_container', 'summary_alias_input', 'alias', alias_value )
- YAHOO.util.Event.addListener( window, 'load', checkForChangedFieldValues, bz_alias_check_array);
+function boldOnChange(e, field_id){
+ var el = document.getElementById(field_id);
+ var elLabel = document.getElementById(field_id + "_label");
+ if( el && elLabel ) {
+ if( el.checked ){
+ YAHOO.util.Dom.setStyle(elLabel, 'font-weight', 'bold');
+ }
+ else{
+ YAHOO.util.Dom.setStyle(elLabel, 'font-weight', 'normal');
+ }
+ }
}
diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl
index 2723c654e..63913beee 100644
--- a/template/en/default/bug/edit.html.tmpl
+++ b/template/en/default/bug/edit.html.tmpl
@@ -379,6 +379,9 @@
<td>
[% PROCESS select selname => "rep_platform" no_td=> 1 %]
[%+ PROCESS select selname => "op_sys" no_td=> 1 %]
+ <script type="text/javascript">
+ assignToDefaultOnChange(['product', 'component']);
+ </script>
</td>
</tr>
@@ -482,7 +485,7 @@
%]
<br>
<input type="checkbox" id="set_default_assignee" name="set_default_assignee" value="1">
- <label for="set_default_assignee">Reset Assignee to default</label>
+ <label id="set_default_assignee_label" for="set_default_assignee">Reset Assignee to default</label>
</div>
<script type="text/javascript">
hideEditableField('bz_assignee_edit_container',
@@ -526,7 +529,10 @@
%]
<br>
<input type="checkbox" id="set_default_qa_contact" name="set_default_qa_contact" value="1">
- <label for="set_default_qa_contact">Reset QA Contact to default</label>
+ <label for="set_default_qa_contact" id="set_default_qa_contact_label">Reset QA Contact to default</label>
+ <script type="text/javascript">
+ initAssignedQA();
+ </script>
</div>
[% IF bug.qa_contact != "" %]
<script type="text/javascript">