summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2009-01-02 00:32:26 +0100
committerlpsolit%gmail.com <>2009-01-02 00:32:26 +0100
commit5c8dab4502c311a7d823171b4c89aaffc2e9761b (patch)
tree1fd3550c30ed7aa7332f2bf7bac244fff7a88cd0 /js
parent7dfa01ebed37c5312b30fd97a56f680de642a9dc (diff)
downloadbugzilla-5c8dab4502c311a7d823171b4c89aaffc2e9761b.tar.gz
bugzilla-5c8dab4502c311a7d823171b4c89aaffc2e9761b.tar.xz
Bug 455476: clicking "mark as duplicate" should focus the dup_id field - Patch by Guy Pyrzak <guy.pyrzak@gmail.com> r/a=mkanat
Diffstat (limited to 'js')
-rw-r--r--js/field.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/js/field.js b/js/field.js
index 21fda4d5a..e8442e964 100644
--- a/js/field.js
+++ b/js/field.js
@@ -159,10 +159,20 @@ function hideEditableField( container, input, action, field_id, original_value )
*
*/
function showEditableField (e, ContainerInputArray) {
+ var inputs = new Array();
+ var inputArea = YAHOO.util.Dom.get(ContainerInputArray[1]);
+ if ( ! inputArea ){
+ YAHOO.util.Event.preventDefault(e);
+ return;
+ }
YAHOO.util.Dom.setStyle(ContainerInputArray[0], 'display', 'none');
- YAHOO.util.Dom.setStyle(ContainerInputArray[1], 'display', 'inline');
- var inputs = YAHOO.util.Dom.get(ContainerInputArray[1]).getElementsByTagName('input')
- if( inputs.length > 0) {
+ YAHOO.util.Dom.setStyle(inputArea, 'display', 'inline');
+ if ( inputArea.tagName.toLowerCase() == "input" ) {
+ inputs.push(inputArea);
+ } else {
+ inputs = inputArea.getElementsByTagName('input');
+ }
+ if ( inputs.length > 0 ) {
// focus on the first field, this makes it easier to edit
inputs[0].focus();
inputs[0].select();
@@ -278,15 +288,19 @@ function showHideStatusItems(e, dupArrayInfo) {
function showDuplicateItem(e) {
var resolution = document.getElementById('resolution');
var bug_status = document.getElementById('bug_status');
+ var dup_id = document.getElementById('dup_id');
if (resolution) {
if (resolution.value == 'DUPLICATE' && bz_isValueInArray( close_status_array, bug_status.value) ) {
// hide resolution show duplicate
YAHOO.util.Dom.setStyle('duplicate_settings', 'display', 'inline');
YAHOO.util.Dom.setStyle('dup_id_discoverable', 'display', 'none');
+ dup_id.focus();
+ dup_id.select();
}
else {
YAHOO.util.Dom.setStyle('duplicate_settings', 'display', 'none');
YAHOO.util.Dom.setStyle('dup_id_discoverable', 'display', 'block');
+ dup_id.blur();
}
}
YAHOO.util.Event.preventDefault(e); //prevents the hyperlink from going to the url in the href.