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 // Generated by CoffeeScript 1.7.1
(function() { (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() { $(function() {
return $("h1").hide().slideDown(500); 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() { Sahli = (function() {
function Sahli() { function Sahli() {
this.emptyfiledef = { this.emptyfiledef = new emptyfiledef;
this.bob = {
"file": "", "file": "",
"name": "", "name": "",
"amiga": true, "amiga": true,
@ -124,13 +145,16 @@
return alert('clicked'); return alert('clicked');
}; };
})(this)); })(this));
$('#listinsert').button({ $('#listappend').button({
icons: { icons: {
primary: "ui-icon-1-n" primary: "ui-icon-1-n"
} }
}).click((function(_this) { }).click((function(_this) {
return function() { return function(event) {
return alert('clicked'); var newentry;
newentry = new emptyfiledef;
_this.data.filedata.push(newentry);
return _this.buildlist(_this.data);
}; };
})(this)); })(this));
$('#listdisplay').button({ $('#listdisplay').button({
@ -180,7 +204,7 @@
_ref2 = _this.data.filedata; _ref2 = _this.data.filedata;
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
name = _ref2[_k]; name = _ref2[_k];
console.log(name.author); console.log(name.author, name.name, name.file);
} }
return console.log('---'); return console.log('---');
}; };
@ -235,7 +259,8 @@
entry.line1 = $("#entryline1").val(); entry.line1 = $("#entryline1").val();
entry.line2 = $("#entryline2").val(); entry.line2 = $("#entryline2").val();
entry.text = $("#entrytext").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) { Sahli.prototype.editline = function(data, pos) {
@ -262,7 +287,7 @@
return function(event) { return function(event) {
event.preventDefault(); event.preventDefault();
_this.save(); _this.save();
return $(this).dialog("close"); return event.currentTarget.previousElementSibling.click();
}; };
})(this) })(this)
} }
@ -428,10 +453,11 @@
}; };
newsahli = function() { newsahli = function() {
var sahli; var newentry, sahli;
sahli = new Sahli; sahli = new Sahli;
sahli.data = sahli.empty; sahli.data = sahli.empty;
sahli.data.filedata.push(sahli.emptyfiledef); newentry = new emptyfiledef;
sahli.data.filedata.push(newentry);
return sahli.edit(); 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, The slide format is currently unused, but consists of a background picture,
a html template, and a css file. 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 class Sahli
constructor: -> constructor: ->
@emptyfiledef = { @emptyfiledef = new emptyfiledef
@bob = {
"file": "", "file": "",
"name": "", "name": "",
"amiga": true, "amiga": true,
@ -134,9 +151,11 @@ edit button.
$('#listlist').button {icons: {primary:"ui-icon-folder-open"}} $('#listlist').button {icons: {primary:"ui-icon-folder-open"}}
.click => .click =>
alert 'clicked' alert 'clicked'
$('#listinsert').button {icons: {primary:"ui-icon-1-n"}} $('#listappend').button {icons: {primary:"ui-icon-1-n"}}
.click => .click (event) =>
alert 'clicked' newentry = new emptyfiledef
@data.filedata.push newentry
@buildlist @data
$('#listdisplay').button {icons: {primary:"ui-icon-refresh"}} $('#listdisplay').button {icons: {primary:"ui-icon-refresh"}}
.click => .click =>
@buildlist @data @buildlist @data
@ -165,7 +184,7 @@ does not alter the array. Alternately, _have_ it alter the array.
s = ui.item.data().startpos s = ui.item.data().startpos
e = ui.item.index() e = ui.item.index()
@data.filedata = @.rearrangearray s,e,@data.filedata @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 '---' console.log '---'
Given a start and and end position, pop the array element at start off and 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) -> additem: (item,pos) ->
entry = @.genentryline item,pos entry = @genentryline item,pos
entry.dblclick => entry.dblclick =>
@.editline item,pos @editline item,pos
genentryline: (item,pos) -> genentryline: (item,pos) ->
arrows = "<span class='ui-icon ui-icon-arrowthick-2-n-s'></span>" 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.line2 = $("#entryline2").val()
entry.text = $("#entrytext").val() entry.text = $("#entrytext").val()
entry.file = $("#entryfile").val() entry.file = $("#entryfile").val()
@buildlist @data
editline: (data,pos) -> editline: (data,pos) ->
$("#formica").dialog { $("#formica").dialog {
@ -223,12 +243,11 @@ insert it into the array at end position. A la the draggon-dropping.
},{ },{
text: "Save", text: "Save",
icons: {primary: 'ui-icon-disk'}, icons: {primary: 'ui-icon-disk'},
click: ((_this) -> click: (event) =>
(event) ->
event.preventDefault() event.preventDefault()
_this.save() @save()
$(this).dialog "close" event.currentTarget.previousElementSibling.click()
)(this)
}] }]
} }
@ -372,7 +391,8 @@ the buttons and create the editor bit as blank.
newsahli = -> newsahli = ->
sahli = new Sahli sahli = new Sahli
sahli.data = sahli.empty sahli.data = sahli.empty
sahli.data.filedata.push sahli.emptyfiledef newentry = new emptyfiledef
sahli.data.filedata.push newentry
sahli.edit() sahli.edit()
And when clicking 'load' we want to load the existing sahli file. 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> <label>Location of Files:<input type="text" id='dirlocation' name="location" value=""></label>
<ol id='sortlist'> <ol id='sortlist'>
</ol> </ol>
<p id='listinsert'>Insert</p> <p id='listappend'>Add</p>
<p id='listlist'>List</p> <p id='listlist'>List</p>
<p id='listdisplay'>Redisplay</p> <p id='listdisplay'>Redisplay</p>
<p id='listsave'>Save</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') @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 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 dump to screen or file, not to console when saving
x 2014-08-06 @EDITOR save (print) routine x 2014-08-06 @EDITOR save (print) routine
@EDITOR text/bg colors change 'SAHLI' thing @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) Add "type" of file(format) - plain, xbin, etc.(
x 2014-08-06 (A) Create Editor - Standalone @EDITOR x 2014-08-06 (A) Create Editor - Standalone @EDITOR