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