reload/list/insert buttons; prepare for fixing delete.

This commit is contained in:
Iam Naughton Phier 2014-08-06 22:36:24 +03:00
parent b613205970
commit 74a8bd80ad
4 changed files with 61 additions and 11 deletions

View file

@ -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 = $("<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();
};

View file

@ -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)

View file

@ -25,6 +25,9 @@
<label>Location of Files:<input type="text" id='dirlocation' name="location" value=""></label>
<ol id='sortlist'>
</ol>
<p id='listinsert'>Insert</p>
<p id='listlist'>List</p>
<p id='listdisplay'>Redisplay</p>
<p id='listsave'>Save</p>
</div>

View file

@ -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