diff --git a/editor/sahliedit.js b/editor/sahliedit.js index 39c1f9c..236a57a 100644 --- a/editor/sahliedit.js +++ b/editor/sahliedit.js @@ -115,6 +115,33 @@ return console.log(dumpjson(_this.data)); }; })(this)); + $('#listlist').button({ + icons: { + primary: "ui-icon-folder-open" + } + }).click((function(_this) { + return function() { + return alert('clicked'); + }; + })(this)); + $('#listinsert').button({ + icons: { + primary: "ui-icon-1-n" + } + }).click((function(_this) { + return function() { + return alert('clicked'); + }; + })(this)); + $('#listdisplay').button({ + icons: { + primary: "ui-icon-refresh" + } + }).click((function(_this) { + return function() { + return _this.buildlist(_this.data); + }; + })(this)); $('#closespan').click(function() { $(this.parentElement.parentElement).hide(); return $('#sahlioutput').text(''); @@ -123,13 +150,19 @@ }; Sahli.prototype.buildlist = function(data) { - var item, x, _i, _len, _ref; + var i, item, x, _i, _j, _len, _len1, _ref, _ref1; $('#list').show(100); - x = 0; - $('#dirlocation').val(this.data.location); + $('#list ol li').remove(); _ref = this.data.filedata; for (_i = 0, _len = _ref.length; _i < _len; _i++) { - item = _ref[_i]; + i = _ref[_i]; + console.log(i.author); + } + x = 0; + $('#dirlocation').val(this.data.location); + _ref1 = this.data.filedata; + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + item = _ref1[_j]; $('#sortlist').append(this.additem(item, x++)); } return $('#sortlist').sortable({ @@ -140,13 +173,13 @@ }, stop: (function(_this) { return function(event, ui) { - var e, name, s, _j, _len1, _ref1; + var e, name, s, _k, _len2, _ref2; s = ui.item.data().startpos; e = ui.item.index(); _this.data.filedata = _this.rearrangearray(s, e, _this.data.filedata); - _ref1 = _this.data.filedata; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - name = _ref1[_j]; + _ref2 = _this.data.filedata; + for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { + name = _ref2[_k]; console.log(name.author); } return console.log('---'); @@ -180,6 +213,7 @@ 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(); }; diff --git a/editor/sahliedit.litcoffee b/editor/sahliedit.litcoffee index 9bddcab..447336c 100644 --- a/editor/sahliedit.litcoffee +++ b/editor/sahliedit.litcoffee @@ -131,6 +131,16 @@ edit button. $('#sahlioutput').text dumpjson @.data $('#dumparea').show 100 console.log dumpjson @.data + $('#listlist').button {icons: {primary:"ui-icon-folder-open"}} + .click => + alert 'clicked' + $('#listinsert').button {icons: {primary:"ui-icon-1-n"}} + .click => + alert 'clicked' + $('#listdisplay').button {icons: {primary:"ui-icon-refresh"}} + .click => + @buildlist @data + $('#closespan').click -> $(@parentElement.parentElement).hide() $('#sahlioutput').text '' @@ -143,6 +153,8 @@ does not alter the array. Alternately, _have_ it alter the array. buildlist: (data) -> $('#list').show 100 + $('#list ol li').remove() + console.log i.author for i in @data.filedata x = 0 $('#dirlocation').val @data.location $('#sortlist').append @.additem item,x++ for item in @data.filedata @@ -178,6 +190,7 @@ insert it into the array at end position. A la the draggon-dropping. .click ((_this) -> (event) -> pos = @.id.replace "del-","" + console.log @ console.log _this.data.filedata.splice pos,1 @.parentNode.remove() )(this) diff --git a/editor/sahlieditor.html b/editor/sahlieditor.html index d4992b5..4fda80d 100644 --- a/editor/sahlieditor.html +++ b/editor/sahlieditor.html @@ -25,6 +25,9 @@
Insert
+List
+Redisplay
Save
diff --git a/todo.txt b/todo.txt index 3f56ad2..6750daf 100644 --- a/todo.txt +++ b/todo.txt @@ -1,7 +1,7 @@ -@EDITOR delete an entry +@EDITOR delete an entry CORRECTLY @EDITOR redo filenames to load from list of files in directory (specfied in 'location') -@EDITOR button to reload filename list from directory -@EDITOR button to insert an entry +x 2014-08-06 @EDITOR button to reload filename list from directory +@EDITOR button to insert an entry - make it insert a blank x 2014-08-06 @EDITOR dump to screen or file, not to console when saving x 2014-08-06 @EDITOR save (print) routine