Permalink
Browse files

Updates for JMVC 3.3 variant

  • Loading branch information...
1 parent 2c49d57 commit 04d97be9aaccf3d54f443dce12bea70c7bdcb5c0 @andykant andykant committed Jul 28, 2012
Showing with 10 additions and 9 deletions.
  1. +2 −2 .gitmodules
  2. +1 −0 jquery
  3. +0 −1 jquerypp
  4. +6 −5 todo/model.js
  5. +1 −1 todo/todo.html
View
@@ -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 jquery
Submodule jquery added at f27d2d
Submodule jquerypp deleted from 84c2fa
View
@@ -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);
}
},
@@ -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});
View
@@ -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]-->

0 comments on commit 04d97be

Please sign in to comment.