Adds a button to remove a file upload before submission (#5670).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6212 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
e6104d344f
commit
e63f0c615c
3 files changed
+19
-5
No files matched your search
@@ -86,9 +86,9 @@ function hideFieldset(el) {
|
||||
var fileFieldCount = 1;
|
||||
|
||||
function addFileField() {
|
||||
if (fileFieldCount >= 10) return false
|
||||
fileFieldCount++;
|
||||
var fields = $('attachments_fields');
|
||||
if (fields.childElements().length >= 10) return false;
|
||||
fileFieldCount++;
|
||||
var s = document.createElement("span");
|
||||
s.update(fields.down('span').innerHTML);
|
||||
s.down('input.file').name = "attachments[" + fileFieldCount + "][file]";
|
||||
@@ -96,6 +96,16 @@ function addFileField() {
|
||||
fields.appendChild(s);
|
||||
}
|
||||
|
||||
function removeFileField(el) {
|
||||
var fields = $('attachments_fields');
|
||||
var s = Element.up(el, 'span');
|
||||
if (fields.childElements().length > 1) {
|
||||
s.remove();
|
||||
} else {
|
||||
s.update(s.innerHTML);
|
||||
}
|
||||
}
|
||||
|
||||
function showTab(name) {
|
||||
var f = $$('div#content .tab-content');
|
||||
for(var i=0; i<f.length; i++){
|
||||
|
||||
@@ -445,6 +445,8 @@ fieldset#notified_events .parent { padding-left: 20px; }
|
||||
.summary {font-style: italic;}
|
||||
|
||||
#attachments_fields input[type=text] {margin-left: 8px; }
|
||||
#attachments_fields span {display:block; white-space:nowrap;}
|
||||
#attachments_fields img {vertical-align: middle;}
|
||||
|
||||
div.attachments { margin-top: 12px; }
|
||||
div.attachments p { margin:4px 0 2px 0; }
|
||||
|
||||
Reference in new issue
Block a user