Simplifies javascript for adding a new file.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6211 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-07-09 19:55:44 +00:00
parent f208fcecca
commit e6104d344f
1 changed files with 8 additions and 20 deletions

View File

@ -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) {