summaryrefslogtreecommitdiffstats
path: root/public/javascripts/application.js
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-09 19:55:44 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-09 19:55:44 +0000
commite6104d344fdc525bde629c39cccba7f65be54a90 (patch)
treed2a55fdb0edb1b0de3db79e2d2432dd78a9567ae /public/javascripts/application.js
parentf208fceccaf91bdcd934e3853c93fbe95c622bf4 (diff)
downloadredmine-e6104d344fdc525bde629c39cccba7f65be54a90.tar.gz
redmine-e6104d344fdc525bde629c39cccba7f65be54a90.zip
Simplifies javascript for adding a new file.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6211 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public/javascripts/application.js')
-rw-r--r--public/javascripts/application.js28
1 files changed, 8 insertions, 20 deletions
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index fdaadc906..e8e8e4add 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -86,26 +86,14 @@ function hideFieldset(el) {
var fileFieldCount = 1;
function addFileField() {
- if (fileFieldCount >= 10) return false
- fileFieldCount++;
- var f = document.createElement("input");
- f.type = "file";
- f.name = "attachments[" + fileFieldCount + "][file]";
- f.size = 30;
- var d = document.createElement("input");
- d.type = "text";
- d.name = "attachments[" + fileFieldCount + "][description]";
- d.size = 60;
- var dLabel = new Element('label');
- dLabel.addClassName('inline');
- // Pulls the languge value used for Optional Description
- dLabel.update($('attachment_description_label_content').innerHTML)
- p = document.getElementById("attachments_fields");
- p.appendChild(document.createElement("br"));
- p.appendChild(f);
- p.appendChild(dLabel);
- dLabel.appendChild(d);
-
+ if (fileFieldCount >= 10) return false
+ fileFieldCount++;
+ var fields = $('attachments_fields');
+ var s = document.createElement("span");
+ s.update(fields.down('span').innerHTML);
+ s.down('input.file').name = "attachments[" + fileFieldCount + "][file]";
+ s.down('input.description').name = "attachments[" + fileFieldCount + "][description]";
+ fields.appendChild(s);
}
function showTab(name) {