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
17188438
Commit
17188438
authored
Jul 07, 2012
by
Addy Osmani
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #212 from petermichaux/master
update to maria.js release candidate 1
parents
8f374e8d
9448fd8f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
13 deletions
+22
-13
labs/architecture-examples/maria/lib/maria/maria.js
labs/architecture-examples/maria/lib/maria/maria.js
+18
-7
labs/architecture-examples/maria/src/index.html
labs/architecture-examples/maria/src/index.html
+0
-1
labs/architecture-examples/maria/src/js/views/TodosAppView.js
.../architecture-examples/maria/src/js/views/TodosAppView.js
+4
-5
No files found.
labs/architecture-examples/maria/lib/maria/maria.js
View file @
17188438
...
...
@@ -1656,7 +1656,7 @@ hormigas.ObjectSet.mixin = function(obj) {
hormigas
.
ObjectSet
.
call
(
obj
);
};
/*
Maria
version 0
- an MVC framework for JavaScript applications
Maria
release candidate 1
- an MVC framework for JavaScript applications
Copyright (c) 2012, Peter Michaux
All rights reserved.
Licensed under the Simplified BSD License.
...
...
@@ -2215,14 +2215,16 @@ will automatically call your "initialize" method.
*/
maria
.
View
=
function
(
model
,
controller
)
{
maria
.
Node
.
call
(
this
);
this
.
initialize
();
this
.
setModel
(
model
);
this
.
setController
(
controller
);
this
.
initialize
();
};
maria
.
Node
.
mixin
(
maria
.
View
.
prototype
);
maria
.
View
.
prototype
.
initialize
=
function
()
{};
maria
.
View
.
prototype
.
initialize
=
function
()
{
// to be overridden by concrete view subclasses
};
maria
.
View
.
prototype
.
destroy
=
function
()
{
maria
.
purgeEventListener
(
this
);
...
...
@@ -2472,15 +2474,23 @@ the same.
*/
maria
.
ElementView
=
function
(
model
,
controller
,
doc
)
{
this
.
_doc
=
doc
||
document
;
maria
.
View
.
call
(
this
,
model
,
controller
);
this
.
setDocument
(
doc
);
};
maria
.
ElementView
.
prototype
=
new
maria
.
View
();
maria
.
ElementView
.
prototype
.
constructor
=
maria
.
ElementView
;
maria
.
ElementView
.
prototype
.
getDocument
=
function
()
{
return
this
.
_doc
;
return
this
.
_doc
||
document
;
};
maria
.
ElementView
.
prototype
.
setDocument
=
function
(
doc
)
{
this
.
_doc
=
doc
;
var
childViews
=
this
.
childNodes
;
for
(
var
i
=
0
,
ilen
=
childViews
.
length
;
i
<
ilen
;
i
++
)
{
childViews
[
i
].
setDocument
(
doc
);
}
};
maria
.
ElementView
.
prototype
.
getTemplate
=
function
()
{
...
...
@@ -2503,7 +2513,7 @@ maria.ElementView.prototype.build = function() {
maria
.
ElementView
.
prototype
.
buildTemplate
=
function
()
{
// parseHTML returns a DocumentFragment so take firstChild as the rootEl
this
.
_rootEl
=
maria
.
parseHTML
(
this
.
getTemplate
(),
this
.
_doc
).
firstChild
;
this
.
_rootEl
=
maria
.
parseHTML
(
this
.
getTemplate
(),
this
.
getDocument
()
).
firstChild
;
};
(
function
()
{
...
...
@@ -3052,7 +3062,8 @@ maria.ElementView.subclass = function(namespace, name, options) {
for
(
var
key
in
uiActions
)
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
uiActions
,
key
))
{
var
methodName
=
uiActions
[
key
];
if
(
!
Object
.
prototype
.
hasOwnProperty
.
call
(
properties
,
methodName
))
{
if
((
!
Object
.
prototype
.
hasOwnProperty
.
call
(
properties
,
methodName
))
&&
(
!
(
methodName
in
this
.
prototype
)))
{
(
function
(
methodName
)
{
properties
[
methodName
]
=
function
(
evt
)
{
this
.
getController
()[
methodName
](
evt
);
...
...
labs/architecture-examples/maria/src/index.html
View file @
17188438
...
...
@@ -16,7 +16,6 @@
</script>
<script
src=
"../lib/maria/maria.js"
></script>
<script
src=
"../lib/aristocrat/aristocrat.js"
></script>
<script
src=
"js/namespace.js"
></script>
...
...
labs/architecture-examples/maria/src/js/views/TodosAppView.js
View file @
17188438
...
...
@@ -7,11 +7,10 @@ maria.ElementView.subclass(checkit, 'TodosAppView', {
return
this
.
find
(
'
.content
'
);
// child views will be appended to this element
},
initialize
:
function
()
{
var
model
=
this
.
getModel
();
this
.
appendChild
(
new
checkit
.
TodosInputView
(
model
));
this
.
appendChild
(
new
checkit
.
TodosToolbarView
(
model
));
this
.
appendChild
(
new
checkit
.
TodosListView
(
model
));
this
.
appendChild
(
new
checkit
.
TodosStatsView
(
model
));
this
.
appendChild
(
new
checkit
.
TodosInputView
());
this
.
appendChild
(
new
checkit
.
TodosToolbarView
());
this
.
appendChild
(
new
checkit
.
TodosListView
());
this
.
appendChild
(
new
checkit
.
TodosStatsView
());
},
insertBefore
:
function
(
newChild
,
oldChild
)
{
newChild
.
setModel
(
this
.
getModel
());
...
...
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