From 54faa4dca2cc3fa584d327ad6cc50560c553d5da Mon Sep 17 00:00:00 2001 From: Howland Owl Date: Tue, 15 Apr 2014 16:23:32 +0300 Subject: [PATCH] sahli file loading complete --- editor/sahliedit.litcoffee | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/editor/sahliedit.litcoffee b/editor/sahliedit.litcoffee index 1a4148b..1990c5a 100644 --- a/editor/sahliedit.litcoffee +++ b/editor/sahliedit.litcoffee @@ -41,7 +41,7 @@ Also hide the editor until needed, and initialize some elements. $(-> $("#loadsahli") .button { disabled: false} - .click -> alert "heyoh!" + .click -> loadsahli() ) $(-> $(".hidden").hide() @@ -90,11 +90,17 @@ a html template, and a css file. } @empty = { "slides": @emptyslidesdef, - "filedef": [ ] + "filedata": [ ] } loader: -> - alert "loader" + $.ajax { + url: '../list.sahli', + dataType: "json", + success: (result) => + @data = result + @.edit() + } Editor functionality: Close the new/load buttons - unneeded now. @@ -107,8 +113,7 @@ edit button. buildlist: (data) -> $('#list').show 100 - @data.filedef[0] ?= @emptyfiledef - @.additem item for item in @data.filedef + @.additem item for item in @data.filedata additem: (item) -> alert dumpjson item @@ -135,11 +140,11 @@ the buttons and create the editor bit as blank. newsahli = -> sahli = new Sahli sahli.data = sahli.empty + sahli.data.filedata.push sahli.emptyfiledef sahli.edit() And when clicking 'load' we want to load the existing sahli file. loadsahli = -> sahli = new Sahli - sahli.data = sahli.loader 'list.sahli' - sahli.edit() + sahli.loader 'list.sahli'