Skip to content

Instantly share code, notes, and snippets.

@erichocean
Created April 14, 2010 04:35
Show Gist options
  • Save erichocean/365457 to your computer and use it in GitHub Desktop.
Save erichocean/365457 to your computer and use it in GitHub Desktop.
issues.hub.js
//
// Model layer
//
// Namspace and API
Issues = hub.Object.create({
store: hub.Hub.create({
uti: 'com.hub.demo.web',
commitRecordsAutomatically: true
}),
add: function() {
var reply = prompt("Issue Description", "New Issue") ;
Issues.store.createRecord(Issues.Issue, {
description: reply,
isDone: false
});
}
});
// Record definitions
Issues.Issue = hub.Record.extend({
isDone: hub.Record.attr(Boolean),
description: hub.Record.attr(String)
});
Issues.Issue.recordTypeName = 'Issues.Issue' ;
// RecordArray definitions
Issues.issues = Issues.store.find(hub.Query.local(Issues.Issue, {
orderBy: 'isDone,description'
}));
// Open the Hub
Issues.store.checkout() ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment