From 7a2877fb210eef3dc8dce25628ed4ec06aab883c Mon Sep 17 00:00:00 2001 From: Iam Naughton Phier Date: Wed, 6 Aug 2014 23:07:37 +0300 Subject: [PATCH] Bugfix: Delete now works (and is much cleaner) --- editor/sahliedit.js | 7 +++---- editor/sahliedit.litcoffee | 11 ++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/editor/sahliedit.js b/editor/sahliedit.js index 236a57a..0072311 100644 --- a/editor/sahliedit.js +++ b/editor/sahliedit.js @@ -212,10 +212,9 @@ amigastatus = ansiorascii(booltoint(item.amiga)); delbutton = $("delete").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 = $("
  • " + arrows + amigastatus + " | " + item.author + " : " + item.name + " : " + item.file + "
  • "); diff --git a/editor/sahliedit.litcoffee b/editor/sahliedit.litcoffee index 447336c..b3b144b 100644 --- a/editor/sahliedit.litcoffee +++ b/editor/sahliedit.litcoffee @@ -187,13 +187,10 @@ insert it into the array at end position. A la the draggon-dropping. arrows = "" amigastatus = ansiorascii booltoint item.amiga delbutton = $("delete") - .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 = $("
  • #{arrows}#{amigastatus} | #{item.author} : #{item.name} : #{item.file}
  • ") entry.append delbutton