bugfix: ansi/ascii status saves correctly

This commit is contained in:
Howland Owl 2014-04-17 09:37:03 +03:00
parent 30d588247f
commit e635fa3ae3
3 changed files with 31 additions and 27 deletions

View file

@ -124,7 +124,8 @@ edit button.
$('#buttonbox').hide()
$('#listsave').button {icons: {primary:"ui-icon-disk"}}
.click =>
alert 'SAVE ME'
console.log dumpjson @.data
You need to save the order, and extract these in that order; moving around
does not alter the array. Alternately, _have_ it alter the array.
@ -160,6 +161,21 @@ insert it into the array at end position. A la the draggon-dropping.
entry.dblclick =>
@.editline item,pos
save: ->
pos = $("#entryindex").val()
entry = @data.filedata[pos]
entry.name = $("#entryname").val()
entry.author = $("#entryauthor").val()
entry.amiga = statustobool $("#entryamiga").children()[1].textContent
console.log $("#entryamiga").children()[1].textContent,entry.amiga,entry.author
entry.color = colortoarray $("#entrycolor").val()
entry.bg = colortoarray $("#entrybg").val()
entry.width = $("#entrywidth").val()
entry.line1 = $("#entryline1").val()
entry.line2 = $("#entryline2").val()
entry.text = $("#entrytext").val()
entry.file = $("#entryfile").val()
editline: (data,pos) ->
$("#formica").dialog {
width:'800',
@ -173,30 +189,15 @@ insert it into the array at end position. A la the draggon-dropping.
},{
text: "Save",
icons: {primary: 'ui-icon-disk'},
click: ->
$('#smt').click()
$(@).dialog "close"
click: ((_this) ->
(event) ->
event.preventDefault()
_this.save()
$(this).dialog "close"
)(this)
}]
}
$("#smt").click (event) =>
event.preventDefault()
pos = $("#entryindex").val()
entry = @data.filedata[pos]
entry.name = $("#entryname").val()
entry.author = $("#entryauthor").val()
entry.amiga = inttobool $("#entryamiga").val()
entry.color = colortoarray $("#entrycolor").val()
entry.bg = colortoarray $("#entrybg").val()
entry.width = $("#entrywidth").val()
entry.line1 = $("#entryline1").val()
entry.line2 = $("#entryline2").val()
entry.text = $("#entrytext").val()
entry.file = $("#entryfile").val()
console.log entry
data.amiga = booltoint data.amiga
$("#entryindex").val pos
@ -217,7 +218,7 @@ insert it into the array at end position. A la the draggon-dropping.
A Helper function to dump json out of an object as text:
dumpjson = (obj) ->
JSON.stringify(obj)
JSON.stringify obj,null,"\t"
Boolean / integer Helpers
@ -227,6 +228,9 @@ Boolean / integer Helpers
inttobool = (intstr) ->
(intstr == 1).toString()
statustobool = (status) ->
if status is 'Ascii' then true else false
Resolve ansi or ascii status
ansiorascii = (status) ->

View file

@ -31,8 +31,8 @@
<li>
<input type="text" id="entryindex" value="" class='hidden'>
<label for="file">File name:</label>
<input id='entryfile' type="hidden" name="file" value="" placeholder="">
<input id='entryfilepick' type="file" name="pickfile" value="" placeholder="">
<input id='entryfile' type="text" name="file" value="" placeholder="">
<input id='entryfilepick' type="file" class='hidden' name="pickfile" value="" placeholder="">
</li>
<li>
<label for="file">Title:</label>
@ -135,7 +135,6 @@
<textarea id='entrytext' name='text'></textarea>
</li>
</div>
<li><input type="submit" name="smt" id="smt" class="hidden" value=""></li>
</ul>
</form>
</div>

View file

@ -18,10 +18,11 @@ x 2014-04-16 (A) - create interface @EDITOR
x 2014-04-16 @EDITOR edit item saves data routine
@EDITOR update the line item when saving
@EDITOR text/bg colors change 'SAHLI' thing
@EDITOR fix filename 'holdover' from previous bit
@EDITOR fix filename 'holdover' from previous bit, 'escape/cancel' reset as well
@EDITOR fix filenames
@EDITOR dump to screen or file, not to console when saving
@EDITOR delete an entry
@EDITOR BUGFIX - ansi/ascii toggle/saving
(A) - parse files for 'info' @EDITOR @SAUCE
x 2014-03-24 (B) Get with dfox on the partymeister package version