Permalink
Browse files

Set sessions collection in reaction to successful fetch from server.

  • Loading branch information...
1 parent 1c7c595 commit 60b2cf99e090a24ffc6196a7a18c3f98bcb5eb07 Craig Walls committed Oct 14, 2012
@@ -2,5 +2,4 @@ S2GX.Collection.extend({
name: "Sessions",
model: S2GX.Models.Session,
url: 'http://localhost:8080/thorax-client/sessions'
-
});
@@ -1,8 +1,10 @@
S2GX.Router.create(module, {
sessions: function() {
- alert("X: " + cache.sessions.length);
var view = this.view('s2gx/Sessions');
- view.setCollection(cache.sessions);
- this.setView(view);
+ var sessions = new S2GX.Collections.Sessions();
+ sessions.load(function() {
+ view.setCollection(sessions);
+ S2GX.layout.setView(view);
+ });
}
});
@@ -1,9 +1,3 @@
-// setup the local session cache
-var cache = {
- sessions: new S2GX.Collections.Sessions()
-};
-cache.sessions.fetch();
-
S2GX.View.extend({
name: 's2gx/Sessions'
});
@@ -1 +1,4 @@
<h2>Sessions</h2>
+{{#each sessions}}
+<li>{{title}}</li>
+{{/each}}

0 comments on commit 60b2cf9

Please sign in to comment.