beginnings of list editor
This commit is contained in:
parent
139764f4f8
commit
c699d3623c
3 changed files with 53 additions and 25 deletions
|
|
@ -23,4 +23,8 @@ pre {
|
||||||
|
|
||||||
label {
|
label {
|
||||||
font-size: 10;
|
font-size: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
#list {
|
||||||
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
@ -27,25 +27,16 @@ Silliness for checking that this works.
|
||||||
|
|
||||||
$(-> $("h1").hide().slideDown(500))
|
$(-> $("h1").hide().slideDown(500))
|
||||||
|
|
||||||
Create a split button to choose between the New and Load functionalities
|
Create buttos to choose between the New and Load functionalities
|
||||||
(As we aren't going to ever load a file _and_ do a new file.)
|
(As we aren't going to ever load a file _and_ do a new file.)
|
||||||
(If someone wants to do that, they can restart with F5 or something.)
|
(If someone wants to do that, they can restart with F5 or something.)
|
||||||
Also hide the hidden things.
|
Also hide the editor until needed, and initialize some elements.
|
||||||
|
|
||||||
$(->
|
$(->
|
||||||
$("#newsahli")
|
$("#newsahli")
|
||||||
.button { disabled: false}
|
.button { disabled: false}
|
||||||
.click ->
|
.click -> newsahli()
|
||||||
newsahli 'new'
|
)
|
||||||
$("#formica").dialog {
|
|
||||||
width:'800',
|
|
||||||
modal: false,
|
|
||||||
title:'Line Item', buttons: [{
|
|
||||||
text: "OK",
|
|
||||||
click: ->
|
|
||||||
$(@).dialog "close"
|
|
||||||
}] }
|
|
||||||
)
|
|
||||||
|
|
||||||
$(->
|
$(->
|
||||||
$("#loadsahli")
|
$("#loadsahli")
|
||||||
|
|
@ -79,7 +70,7 @@ a html template, and a css file.
|
||||||
|
|
||||||
class Sahli
|
class Sahli
|
||||||
constructor: ->
|
constructor: ->
|
||||||
@filedef = {
|
@emptyfiledef = {
|
||||||
"file": "",
|
"file": "",
|
||||||
"name": "",
|
"name": "",
|
||||||
"amiga": true,
|
"amiga": true,
|
||||||
|
|
@ -92,21 +83,46 @@ a html template, and a css file.
|
||||||
"line2": "",
|
"line2": "",
|
||||||
"text": ""
|
"text": ""
|
||||||
}
|
}
|
||||||
@slidesdef = {
|
@emptyslidesdef = {
|
||||||
"background": "",
|
"background": "",
|
||||||
"template": "",
|
"template": "",
|
||||||
"css": ""
|
"css": ""
|
||||||
}
|
}
|
||||||
@blank = {
|
@empty = {
|
||||||
"slides": @slidesdef,
|
"slides": @emptyslidesdef,
|
||||||
"filedef": [ @filedef ]
|
"filedef": [ ]
|
||||||
}
|
}
|
||||||
|
|
||||||
loader: ->
|
loader: ->
|
||||||
alert "loader"
|
alert "loader"
|
||||||
|
|
||||||
editor: (data) ->
|
Editor functionality:
|
||||||
q = data
|
Close the new/load buttons - unneeded now.
|
||||||
|
list, and allow dragon-droppings for sorting. Doubleclick to edit, or use
|
||||||
|
edit button.
|
||||||
|
|
||||||
|
edit: ->
|
||||||
|
$('#buttonbox').hide()
|
||||||
|
@buildlist @data
|
||||||
|
|
||||||
|
buildlist: (data) ->
|
||||||
|
$('#list').show 100
|
||||||
|
@data.filedef[0] ?= @emptyfiledef
|
||||||
|
@.additem item for item in @data.filedef
|
||||||
|
|
||||||
|
additem: (item) ->
|
||||||
|
alert dumpjson item
|
||||||
|
|
||||||
|
editline: (data) ->
|
||||||
|
$("#formica").dialog {
|
||||||
|
width:'800',
|
||||||
|
modal: false,
|
||||||
|
title:'Line Item', buttons: [{
|
||||||
|
text: "OK",
|
||||||
|
click: ->
|
||||||
|
$(@).dialog "close"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
A Helper function to dump json out of an object as text:
|
A Helper function to dump json out of an object as text:
|
||||||
|
|
||||||
|
|
@ -118,10 +134,12 @@ the buttons and create the editor bit as blank.
|
||||||
|
|
||||||
newsahli = ->
|
newsahli = ->
|
||||||
sahli = new Sahli
|
sahli = new Sahli
|
||||||
$('#buttonbox').hide()
|
sahli.data = sahli.empty
|
||||||
sahli.data = sahli.blank
|
sahli.edit()
|
||||||
sahli.editor sahli.data.filedef
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
And when clicking 'load' we want to load the existing sahli file.
|
||||||
|
|
||||||
|
loadsahli = ->
|
||||||
|
sahli = new Sahli
|
||||||
|
sahli.data = sahli.loader 'list.sahli'
|
||||||
|
sahli.edit()
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class='hidden' id='list'>
|
||||||
|
<ol id='sortlist'>
|
||||||
|
<li class='entry'author - title></li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class='hidden' id='formica'>
|
<div class='hidden' id='formica'>
|
||||||
<form accept-charset="utf-8">
|
<form accept-charset="utf-8">
|
||||||
<ol>
|
<ol>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue