Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
todomvc
Commits
0bd96e8d
Commit
0bd96e8d
authored
Mar 09, 2013
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partially revert
ffff5854
Unquoting attributes causes issues with the closure compiler.
parent
d29ad7ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
36 deletions
+36
-36
labs/architecture-examples/plastronjs/js/models/listmodel.js
labs/architecture-examples/plastronjs/js/models/listmodel.js
+28
-28
labs/architecture-examples/plastronjs/js/models/todomodel.js
labs/architecture-examples/plastronjs/js/models/todomodel.js
+7
-7
labs/architecture-examples/plastronjs/js/sync/listsync.js
labs/architecture-examples/plastronjs/js/sync/listsync.js
+1
-1
No files found.
labs/architecture-examples/plastronjs/js/models/listmodel.js
View file @
0bd96e8d
...
...
@@ -10,67 +10,67 @@ goog.require('todomvc.todomodel');
* @constructor
* @extends {mvc.Collection}
*/
todomvc
.
listmodel
=
function
()
{
todomvc
.
listmodel
=
function
()
{
var
todosSchema
=
{
// number of completed
completed
:
{
get
:
function
()
{
'
completed
'
:
{
get
:
function
()
{
return
this
.
getModels
(
'
completed
'
).
length
;
},
models
:
true
},
allDone
:
{
get
:
function
()
{
return
this
.
getLength
()
===
this
.
getModels
(
'
completed
'
).
length
;
'
allDone
'
:
{
get
:
function
()
{
return
this
.
getLength
()
===
this
.
getModels
(
'
completed
'
).
length
;
},
set
:
function
(
done
)
{
goog
.
array
.
forEach
(
this
.
getModels
(
'
none
'
),
function
(
model
)
{
model
.
set
(
'
completed
'
,
done
);
set
:
function
(
done
)
{
goog
.
array
.
forEach
(
this
.
getModels
(
'
none
'
),
function
(
model
)
{
model
.
set
(
'
completed
'
,
done
);
});
},
models
:
true
},
// number of active models
active
:
{
get
:
function
()
{
return
this
.
getLength
()
-
this
.
getModels
(
'
completed
'
).
length
;
'
active
'
:
{
get
:
function
()
{
return
this
.
getLength
()
-
this
.
getModels
(
'
completed
'
).
length
;
},
models
:
true
},
// the total
total
:
{
get
:
function
()
{
'
total
'
:
{
get
:
function
()
{
return
this
.
getLength
();
},
models
:
true
}
};
goog
.
base
(
this
,
{
id
:
'
todos-plastronjs
'
,
sync
:
new
todomvc
.
listsync
(),
schema
:
todosSchema
,
modelType
:
todomvc
.
todomodel
goog
.
base
(
this
,
{
'
id
'
:
'
todos-plastronjs
'
,
'
sync
'
:
new
todomvc
.
listsync
(),
'
schema
'
:
todosSchema
,
'
modelType
'
:
todomvc
.
todomodel
});
// fetch from localstorage
this
.
fetch
();
// save on any changes
this
.
anyModelChange
(
this
.
save
);
this
.
anyModelChange
(
this
.
save
);
};
goog
.
inherits
(
todomvc
.
listmodel
,
mvc
.
Collection
);
goog
.
inherits
(
todomvc
.
listmodel
,
mvc
.
Collection
);
todomvc
.
listmodel
.
Filter
=
{
none
:
function
()
{
'
none
'
:
function
()
{
return
true
;
},
active
:
function
(
model
)
{
'
active
'
:
function
(
model
)
{
return
!
model
.
get
(
'
completed
'
);
},
completed
:
function
(
model
)
{
'
completed
'
:
function
(
model
)
{
return
model
.
get
(
'
completed
'
);
}
};
...
...
@@ -81,17 +81,17 @@ todomvc.listmodel.Filter = {
*
* @inheritDoc
*/
todomvc
.
listmodel
.
prototype
.
getModels
=
function
(
optFilter
)
{
todomvc
.
listmodel
.
prototype
.
getModels
=
function
(
opt_filter
)
{
return
goog
.
base
(
this
,
'
getModels
'
,
todomvc
.
listmodel
.
Filter
[
optFilter
||
this
.
get
(
'
filter
'
)
]
);
todomvc
.
listmodel
.
Filter
[
opt_filter
||
this
.
get
(
'
filter
'
)]
);
};
/**
* @return {Object} todos as json.
*/
todomvc
.
listmodel
.
prototype
.
toJson
=
function
()
{
return
goog
.
array
.
map
(
this
.
getModels
(
'
none
'
),
function
(
mod
)
{
todomvc
.
listmodel
.
prototype
.
toJson
=
function
()
{
return
goog
.
array
.
map
(
this
.
getModels
(
'
none
'
),
function
(
mod
)
{
return
mod
.
toJson
();
});
};
labs/architecture-examples/plastronjs/js/models/todomodel.js
View file @
0bd96e8d
...
...
@@ -10,14 +10,14 @@ goog.require('mvc.Model.ValidateError');
* @param {Object=} opt_options to be put on the model.
* @extends {mvc.Model}
*/
todomvc
.
todomodel
=
function
(
opt_options
)
{
goog
.
base
(
this
,
opt_options
);
todomvc
.
todomodel
=
function
(
opt_options
)
{
goog
.
base
(
this
,
opt_options
);
// title must have a length, also format to remove spaces
this
.
setter
(
'
title
'
,
function
(
title
)
{
var
updated
=
goog
.
string
.
trim
(
title
);
this
.
setter
(
'
title
'
,
function
(
title
)
{
var
updated
=
goog
.
string
.
trim
(
title
);
if
(
!
updated
.
length
)
{
if
(
!
updated
.
length
)
{
throw
new
mvc
.
Model
.
ValidateError
(
'
null string
'
);
}
...
...
@@ -25,8 +25,8 @@ todomvc.todomodel = function( opt_options ) {
});
// when a note title is no longer valid then remove it
this
.
errorHandler
(
function
()
{
this
.
errorHandler
(
function
()
{
this
.
dispose
();
});
};
goog
.
inherits
(
todomvc
.
todomodel
,
mvc
.
Model
);
goog
.
inherits
(
todomvc
.
todomodel
,
mvc
.
Model
);
labs/architecture-examples/plastronjs/js/sync/listsync.js
View file @
0bd96e8d
...
...
@@ -17,7 +17,7 @@ goog.inherits( todomvc.listsync, mvc.LocalSync );
/**
* @inheritDoc
*/
todomvc
.
listsync
.
prototype
.
read
=
function
(
model
)
{
todomvc
.
listsync
.
prototype
.
read
=
function
(
model
,
opt_callback
)
{
var
id
=
/** @type {string} */
(
model
.
get
(
'
id
'
));
var
todos
=
this
.
store_
.
get
(
id
)
||
[];
goog
.
array
.
forEach
(
/** @type {Array} */
(
todos
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment