From 329d36207d4447006af4a958cb93c98632325527 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Tue, 15 Jul 2014 13:57:34 -0700 Subject: [PATCH] check in hello world xos dashboard --- .../core/xoslib/dashboards/helloworld.html | 13 +++++++++ .../core/xoslib/static/js/helloworld.js | 27 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 planetstack/core/xoslib/dashboards/helloworld.html create mode 100644 planetstack/core/xoslib/static/js/helloworld.js diff --git a/planetstack/core/xoslib/dashboards/helloworld.html b/planetstack/core/xoslib/dashboards/helloworld.html new file mode 100644 index 0000000..9b61487 --- /dev/null +++ b/planetstack/core/xoslib/dashboards/helloworld.html @@ -0,0 +1,13 @@ + +
Hello, {{ user.firstname }} {{ user.lastname }}.
+
This is the hello world view. The value of foobar is {{ foobar }}.
+
+

Type a new description for the the first slice in the collection:

+ + + + + + + + diff --git a/planetstack/core/xoslib/static/js/helloworld.js b/planetstack/core/xoslib/static/js/helloworld.js new file mode 100644 index 0000000..1563094 --- /dev/null +++ b/planetstack/core/xoslib/static/js/helloworld.js @@ -0,0 +1,27 @@ +// helloworld.js +function updateHelloWorldData() { + var html = ""; + for (var slicekey in xos.slices.models) { + slice = xos.slices.models[slicekey] + html = html + ""; + } + html = html + "
" + slice.get("name") + "" + slice.get("description") + "
"; + $('#dynamicTableOfInterestingThings').html(html); +} + +$(document).ready(function(){ + xos.slices.on("change", function() { updateHelloWorldData(); }); + xos.slices.on("remove", function() { updateHelloWorldData(); }); + xos.slices.on("sort", function() { updateHelloWorldData(); }); + + xos.slices.startPolling(); +}); + +// helloworld.js +$(document).ready(function() { + $('#submitNewDescription').bind('click', function() { + newDescription = $("#newDescription").val(); + xos.slices.models[0].set("description", newDescription); + xos.slices.models[0].save(); + }); +}); -- 2.43.0