diff options
author | Asbjørn Sloth Tønnesen <asbjorn@asbjorn.biz> | 2012-06-28 19:49:45 +0000 |
---|---|---|
committer | Asbjørn Sloth Tønnesen <asbjorn@asbjorn.biz> | 2012-06-28 19:49:45 +0000 |
commit | 5e54ba7aa27b95d1e0568693915e735ab8058ff7 (patch) | |
tree | 1c2743605a6cce00edb82b5f15b9a3f08f6ace30 /web/js/labitrack.d/41-create.js | |
download | labitrack-5e54ba7aa27b95d1e0568693915e735ab8058ff7.tar.gz labitrack-5e54ba7aa27b95d1e0568693915e735ab8058ff7.tar.xz labitrack-5e54ba7aa27b95d1e0568693915e735ab8058ff7.zip |
Initial version
Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.biz>
Diffstat (limited to 'web/js/labitrack.d/41-create.js')
-rw-r--r-- | web/js/labitrack.d/41-create.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/web/js/labitrack.d/41-create.js b/web/js/labitrack.d/41-create.js new file mode 100644 index 0000000..ec689c4 --- /dev/null +++ b/web/js/labitrack.d/41-create.js @@ -0,0 +1,29 @@ +(function(){ + function on_submit(label, o) { + o.save(undef, { + success: function(){ + label.set_data(o.toJSON()); + label.print(); + + console.log('Saved with id: ' + o.get('id')); + } + }); + } + + var view = λ.routableview.extend({ + render: function () { + λ.setcontent('create', { + save_text: 'Save and queue for printing', + data: {}, + tags: λ.tags + }); + var o = new λ.o(); + λ.labelform({ + model: o, + submit: on_submit + }); + } + }); + + view.route('', 'create'); +}()); |