sahli file loading complete
This commit is contained in:
parent
c699d3623c
commit
54faa4dca2
1 changed files with 12 additions and 7 deletions
|
|
@ -41,7 +41,7 @@ Also hide the editor until needed, and initialize some elements.
|
||||||
$(->
|
$(->
|
||||||
$("#loadsahli")
|
$("#loadsahli")
|
||||||
.button { disabled: false}
|
.button { disabled: false}
|
||||||
.click -> alert "heyoh!"
|
.click -> loadsahli()
|
||||||
)
|
)
|
||||||
$(->
|
$(->
|
||||||
$(".hidden").hide()
|
$(".hidden").hide()
|
||||||
|
|
@ -90,11 +90,17 @@ a html template, and a css file.
|
||||||
}
|
}
|
||||||
@empty = {
|
@empty = {
|
||||||
"slides": @emptyslidesdef,
|
"slides": @emptyslidesdef,
|
||||||
"filedef": [ ]
|
"filedata": [ ]
|
||||||
}
|
}
|
||||||
|
|
||||||
loader: ->
|
loader: ->
|
||||||
alert "loader"
|
$.ajax {
|
||||||
|
url: '../list.sahli',
|
||||||
|
dataType: "json",
|
||||||
|
success: (result) =>
|
||||||
|
@data = result
|
||||||
|
@.edit()
|
||||||
|
}
|
||||||
|
|
||||||
Editor functionality:
|
Editor functionality:
|
||||||
Close the new/load buttons - unneeded now.
|
Close the new/load buttons - unneeded now.
|
||||||
|
|
@ -107,8 +113,7 @@ edit button.
|
||||||
|
|
||||||
buildlist: (data) ->
|
buildlist: (data) ->
|
||||||
$('#list').show 100
|
$('#list').show 100
|
||||||
@data.filedef[0] ?= @emptyfiledef
|
@.additem item for item in @data.filedata
|
||||||
@.additem item for item in @data.filedef
|
|
||||||
|
|
||||||
additem: (item) ->
|
additem: (item) ->
|
||||||
alert dumpjson item
|
alert dumpjson item
|
||||||
|
|
@ -135,11 +140,11 @@ 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
|
||||||
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.
|
||||||
|
|
||||||
loadsahli = ->
|
loadsahli = ->
|
||||||
sahli = new Sahli
|
sahli = new Sahli
|
||||||
sahli.data = sahli.loader 'list.sahli'
|
sahli.loader 'list.sahli'
|
||||||
sahli.edit()
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue