Bugfix: Delete now works (and is much cleaner)

This commit is contained in:
Iam Naughton Phier 2014-08-06 23:07:37 +03:00
parent 74a8bd80ad
commit 7a2877fb21
2 changed files with 7 additions and 11 deletions

View file

@ -212,10 +212,9 @@
amigastatus = ansiorascii(booltoint(item.amiga)); amigastatus = ansiorascii(booltoint(item.amiga));
delbutton = $("<span class='righty' id=del-" + pos + ">delete</span>").click((function(_this) { delbutton = $("<span class='righty' id=del-" + pos + ">delete</span>").click((function(_this) {
return function(event) { return function(event) {
pos = this.id.replace("del-", ""); pos = event.currentTarget.id.replace("del-", "");
console.log(this); _this.data.filedata.splice(pos, 1);
console.log(_this.data.filedata.splice(pos, 1)); return _this.buildlist(_this.data);
return this.parentNode.remove();
}; };
})(this)); })(this));
entry = $("<li class='entry' id='" + item.file + "'>" + arrows + amigastatus + " | " + item.author + " : " + item.name + " : " + item.file + "</li>"); entry = $("<li class='entry' id='" + item.file + "'>" + arrows + amigastatus + " | " + item.author + " : " + item.name + " : " + item.file + "</li>");

View file

@ -187,13 +187,10 @@ insert it into the array at end position. A la the draggon-dropping.
arrows = "<span class='ui-icon ui-icon-arrowthick-2-n-s'></span>" arrows = "<span class='ui-icon ui-icon-arrowthick-2-n-s'></span>"
amigastatus = ansiorascii booltoint item.amiga amigastatus = ansiorascii booltoint item.amiga
delbutton = $("<span class='righty' id=del-#{pos}>delete</span>") delbutton = $("<span class='righty' id=del-#{pos}>delete</span>")
.click ((_this) -> .click (event) =>
(event) -> pos = event.currentTarget.id.replace "del-",""
pos = @.id.replace "del-","" @data.filedata.splice pos,1
console.log @ @buildlist @data
console.log _this.data.filedata.splice pos,1
@.parentNode.remove()
)(this)
entry = $("<li class='entry' id='#{item.file}'>#{arrows}#{amigastatus} | #{item.author} : #{item.name} : #{item.file}</li>") entry = $("<li class='entry' id='#{item.file}'>#{arrows}#{amigastatus} | #{item.author} : #{item.name} : #{item.file}</li>")
entry.append delbutton entry.append delbutton