bugfixes: deletes, moves, adds.

- still have a strange bug when you add, then move. Unsure why,
 but it doesn't edit properly.
This commit is contained in:
Iam Naughton Phier 2014-08-07 00:23:36 +03:00
parent 7a2877fb21
commit c5e51be5ba
4 changed files with 73 additions and 27 deletions

View file

@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.7.1
(function() {
var Sahli, ansiorascii, arraytocolor, booltoint, colorindex, colortoarray, colortoname, dec2hex, dumpjson, hex2dec, inttobool, loadsahli, newsahli, resolvefiletype, statustobool;
var Sahli, ansiorascii, arraytocolor, booltoint, colorindex, colortoarray, colortoname, dec2hex, dumpjson, emptyfiledef, hex2dec, inttobool, loadsahli, newsahli, resolvefiletype, statustobool;
$(function() {
return $("h1").hide().slideDown(500);
@ -56,9 +56,30 @@
});
});
emptyfiledef = (function() {
function emptyfiledef() {
this.file = "";
this.name = "";
this.amiga = true;
this.filetype = 'plain';
this.width = "";
this.author = "";
this.font = "Propaz";
this.color = [255, 255, 255, 255];
this.bg = [0, 0, 0, 0];
this.line1 = "";
this.line2 = "";
this.text = "";
}
return emptyfiledef;
})();
Sahli = (function() {
function Sahli() {
this.emptyfiledef = {
this.emptyfiledef = new emptyfiledef;
this.bob = {
"file": "",
"name": "",
"amiga": true,
@ -124,13 +145,16 @@
return alert('clicked');
};
})(this));
$('#listinsert').button({
$('#listappend').button({
icons: {
primary: "ui-icon-1-n"
}
}).click((function(_this) {
return function() {
return alert('clicked');
return function(event) {
var newentry;
newentry = new emptyfiledef;
_this.data.filedata.push(newentry);
return _this.buildlist(_this.data);
};
})(this));
$('#listdisplay').button({
@ -180,7 +204,7 @@
_ref2 = _this.data.filedata;
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
name = _ref2[_k];
console.log(name.author);
console.log(name.author, name.name, name.file);
}
return console.log('---');
};
@ -235,7 +259,8 @@
entry.line1 = $("#entryline1").val();
entry.line2 = $("#entryline2").val();
entry.text = $("#entrytext").val();
return entry.file = $("#entryfile").val();
entry.file = $("#entryfile").val();
return this.buildlist(this.data);
};
Sahli.prototype.editline = function(data, pos) {
@ -262,7 +287,7 @@
return function(event) {
event.preventDefault();
_this.save();
return $(this).dialog("close");
return event.currentTarget.previousElementSibling.click();
};
})(this)
}
@ -428,10 +453,11 @@
};
newsahli = function() {
var sahli;
var newentry, sahli;
sahli = new Sahli;
sahli.data = sahli.empty;
sahli.data.filedata.push(sahli.emptyfiledef);
newentry = new emptyfiledef;
sahli.data.filedata.push(newentry);
return sahli.edit();
};

View file

@ -81,9 +81,26 @@ The three remaining lines are informational and optional.
The slide format is currently unused, but consists of a background picture,
a html template, and a css file.
class emptyfiledef
constructor: ->
@file = ""
@name = ""
@amiga = true
@filetype = 'plain'
@width = ""
@author = ""
@font = "Propaz"
@color = [ 255,255,255,255 ]
@bg = [ 0,0,0,0 ]
@line1 = ""
@line2 = ""
@text = ""
class Sahli
constructor: ->
@emptyfiledef = {
@emptyfiledef = new emptyfiledef
@bob = {
"file": "",
"name": "",
"amiga": true,
@ -134,9 +151,11 @@ edit button.
$('#listlist').button {icons: {primary:"ui-icon-folder-open"}}
.click =>
alert 'clicked'
$('#listinsert').button {icons: {primary:"ui-icon-1-n"}}
.click =>
alert 'clicked'
$('#listappend').button {icons: {primary:"ui-icon-1-n"}}
.click (event) =>
newentry = new emptyfiledef
@data.filedata.push newentry
@buildlist @data
$('#listdisplay').button {icons: {primary:"ui-icon-refresh"}}
.click =>
@buildlist @data
@ -165,7 +184,7 @@ does not alter the array. Alternately, _have_ it alter the array.
s = ui.item.data().startpos
e = ui.item.index()
@data.filedata = @.rearrangearray s,e,@data.filedata
console.log name.author for name in @data.filedata
console.log name.author,name.name,name.file for name in @data.filedata
console.log '---'
Given a start and and end position, pop the array element at start off and
@ -179,9 +198,9 @@ insert it into the array at end position. A la the draggon-dropping.
additem: (item,pos) ->
entry = @.genentryline item,pos
entry = @genentryline item,pos
entry.dblclick =>
@.editline item,pos
@editline item,pos
genentryline: (item,pos) ->
arrows = "<span class='ui-icon ui-icon-arrowthick-2-n-s'></span>"
@ -209,6 +228,7 @@ insert it into the array at end position. A la the draggon-dropping.
entry.line2 = $("#entryline2").val()
entry.text = $("#entrytext").val()
entry.file = $("#entryfile").val()
@buildlist @data
editline: (data,pos) ->
$("#formica").dialog {
@ -223,12 +243,11 @@ insert it into the array at end position. A la the draggon-dropping.
},{
text: "Save",
icons: {primary: 'ui-icon-disk'},
click: ((_this) ->
(event) ->
click: (event) =>
event.preventDefault()
_this.save()
$(this).dialog "close"
)(this)
@save()
event.currentTarget.previousElementSibling.click()
}]
}
@ -372,7 +391,8 @@ the buttons and create the editor bit as blank.
newsahli = ->
sahli = new Sahli
sahli.data = sahli.empty
sahli.data.filedata.push sahli.emptyfiledef
newentry = new emptyfiledef
sahli.data.filedata.push newentry
sahli.edit()
And when clicking 'load' we want to load the existing sahli file.

View file

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

View file

@ -1,12 +1,12 @@
@EDITOR delete an entry CORRECTLY
x 2014-08-06 @EDITOR delete an entry CORRECTLY
@EDITOR redo filenames to load from list of files in directory (specfied in 'location')
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-07 @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
@EDITOR text/bg colors change 'SAHLI' thing
@EDITOR update the line item when saving - what the heck is 'line item?'
x 2014-08-07 @EDITOR update the line item when saving - what the heck is 'line item?' (meant update the listing to show edits)
x 2014-08-06 (A) Add "type" of file(format) - plain, xbin, etc.(
x 2014-08-06 (A) Create Editor - Standalone @EDITOR