summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/web
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-11-25 06:08:29 +0100
committerByron Jones <glob@mozilla.com>2014-11-25 06:08:29 +0100
commit55d148d167630fce08f40e6fcf2ab9def0b9699d (patch)
treebe58dc3c44c5680c4574e3054b3be6ce9e5faebb /extensions/BMO/web
parent9bb992c0b0607328cc2356cb35b2d439fd7024af (diff)
downloadbugzilla-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.js18
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;
+ }
+ }
+ }
}
}