summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-09 20:11:18 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-09 20:11:18 +0000
commite63f0c615cb353927ed9ff416f26e57b4f57c8b0 (patch)
treea5698dba31acf457141e1d5f63aaccaa3bd46dec /public
parente6104d344fdc525bde629c39cccba7f65be54a90 (diff)
downloadredmine-e63f0c615cb353927ed9ff416f26e57b4f57c8b0.tar.gz
redmine-e63f0c615cb353927ed9ff416f26e57b4f57c8b0.zip
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
Diffstat (limited to 'public')
-rw-r--r--public/javascripts/application.js14
-rw-r--r--public/stylesheets/application.css2
2 files changed, 14 insertions, 2 deletions
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index e8e8e4add..19aef77b8 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -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++){
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index d621b5d1d..ddaba211a 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -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; }