diff options
author | Byron Jones <glob@mozilla.com> | 2014-11-25 06:08:29 +0100 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-11-25 06:08:29 +0100 |
commit | 55d148d167630fce08f40e6fcf2ab9def0b9699d (patch) | |
tree | be58dc3c44c5680c4574e3054b3be6ce9e5faebb /extensions/BMO/web | |
parent | 9bb992c0b0607328cc2356cb35b2d439fd7024af (diff) | |
download | bugzilla-55d148d167630fce08f40e6fcf2ab9def0b9699d.tar.gz bugzilla-55d148d167630fce08f40e6fcf2ab9def0b9699d.tar.xz |
Bug 1103837: Bug Bounty Entry Form no longer edits bounty attachment description
Diffstat (limited to 'extensions/BMO/web')
-rw-r--r-- | extensions/BMO/web/js/attachment_bounty_form.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/extensions/BMO/web/js/attachment_bounty_form.js b/extensions/BMO/web/js/attachment_bounty_form.js index cdec78276..59ffe8479 100644 --- a/extensions/BMO/web/js/attachment_bounty_form.js +++ b/extensions/BMO/web/js/attachment_bounty_form.js @@ -8,11 +8,27 @@ function add_bounty_attachment(bug_id) { var nodes = YAHOO.util.Selector.query('#attachment_table tr.bz_attach_footer td'); if (nodes) { + var existing = document.getElementById('bounty_attachment'); var td = nodes[0]; var a = document.createElement('a'); a.href = 'page.cgi?id=attachment_bounty_form.html&bug_id=' + bug_id; - a.appendChild(document.createTextNode('Add bounty tracking attachment')); + a.appendChild(document.createTextNode(existing + ? 'Edit bounty tracking attachment' + : 'Add bounty tracking attachment')); td.appendChild(document.createElement('br')); td.appendChild(a); + + if (existing) { + var tr = existing.parentNode.parentNode; + if (tr.nodeName != 'TR') + return; + nodes = tr.getElementsByTagName('a'); + for (var i = 0, il = nodes.length; i < il; i++) { + if (nodes[i].href.match(/attachment\.cgi\?id=\d+$/)) { + nodes[i].href = a.href; + return; + } + } + } } } |