Permalink
Browse files

Fix Asset.addInput function to work with latest version of prototype

When adding another file I also clear the file input because there is no reason to upload the same file again.
  • Loading branch information...
1 parent 7bb054c commit 0eab35f11bae7878ceb19c15863c410e0e1093e3 @isaackearse isaackearse committed Mar 12, 2009
Showing with 4 additions and 3 deletions.
  1. +4 −3 public/javascripts/mephisto/application.js
@@ -116,10 +116,11 @@ Asset = {
addInput: function() {
var list = $('filefields'), copyFrom = list.down(), tagsall = $('tagsall');
var newNode = copyFrom.cloneNode(true), files = list.getElementsByTagName('li');
- var close = document.getElementsByClassName('remove-file', newNode)[0];
- Element.remove(document.getElementsByClassName('tagsall', newNode)[0]);
+ var close = newNode.down('.remove-file');
+ newNode.down('.tagsall').remove();
+ newNode.down('input').clear();
Event.observe(close, 'click', function(e) {
- Event.findElement(e, 'li').remove();
+ this.up('li').remove();
if(tagsall.visible() && files.length == 1) tagsall.hide();
});
close.show();

0 comments on commit 0eab35f

Please sign in to comment.