Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
Set sessions collection in reaction to successful fetch from server.
Browse files Browse the repository at this point in the history
  • Loading branch information
habuma committed Oct 14, 2012
1 parent 1c7c595 commit 60b2cf9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
Expand Up @@ -2,5 +2,4 @@ S2GX.Collection.extend({
name: "Sessions",
model: S2GX.Models.Session,
url: 'http://localhost:8080/thorax-client/sessions'

});
8 changes: 5 additions & 3 deletions thorax-lumbar-client/src/main/thorax/js/routers/s2gx.js
@@ -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'
});
Expand Down
@@ -1 +1,4 @@
<h2>Sessions</h2>
{{#each sessions}}
<li>{{title}}</li>
{{/each}}

0 comments on commit 60b2cf9

Please sign in to comment.