Skip to content

Commit

Permalink
Updates for JMVC 3.3 variant
Browse files Browse the repository at this point in the history
  • Loading branch information
andykant committed Jul 28, 2012
1 parent 2c49d57 commit 04d97be
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Expand Up @@ -7,6 +7,6 @@
[submodule "can"]
path = can
url = git@github.com:jupiterjs/canjs.git
[submodule "jquerypp"]
path = jquerypp
[submodule "jquery"]
path = jquery
url = git@github.com:jupiterjs/jquerypp.git
1 change: 1 addition & 0 deletions jquery
Submodule jquery added at f27d2d
1 change: 0 additions & 1 deletion jquerypp
Submodule jquerypp deleted from 84c2fa
11 changes: 6 additions & 5 deletions todo/model.js
@@ -1,19 +1,20 @@
steal('can/model').then(function() {
steal('can/model',
'jquery/lang/json').then(function() {

// Basic Todo entry model
// { text: 'todo', complete: false }
can.Model('Todo', {

// Implement local storage handling
localStore: function(cb){
var name = 'todos-canjs-jquery',
data = JSON.parse( window.localStorage[name] || (window.localStorage[name] = '[]') ),
var name = 'todos-jmvc',
data = $.evalJSON( window.localStorage[name] || (window.localStorage[name] = '[]') ),
res = cb.call(this, data);
if(res !== false){
can.each(data, function(i, todo) {
delete todo.editing;
});
window.localStorage[name] = JSON.stringify(data);
window.localStorage[name] = $.toJSON(data);
}
},

Expand All @@ -22,7 +23,7 @@ steal('can/model').then(function() {
this.localStore(function(todos){
var instances = [],
self = this;
can.each(todos, function(i, todo) {
can.each(todos, function(todo, i) {
instances.push(new self(todo));
});
def.resolve({data: instances});
Expand Down
2 changes: 1 addition & 1 deletion todo/todo.html
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Todo - DoneJS with jQuery</title>
<title>Todo - JavaScriptMVC 3.3</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
Expand Down

0 comments on commit 04d97be

Please sign in to comment.