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
Eugene Shen
todomvc
Commits
15be3631
Commit
15be3631
authored
Mar 10, 2014
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #873 from cliffhall/gh-pages
Fix outstanding issues with PureMVC implementation
parents
27a39afd
534e6832
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
labs/architecture-examples/puremvc/js/model/proxy/TodoProxy.js
...architecture-examples/puremvc/js/model/proxy/TodoProxy.js
+1
-1
labs/architecture-examples/puremvc/js/view/component/TodoForm.js
...chitecture-examples/puremvc/js/view/component/TodoForm.js
+22
-1
No files found.
labs/architecture-examples/puremvc/js/model/proxy/TodoProxy.js
View file @
15be3631
...
...
@@ -110,7 +110,7 @@ puremvc.define({
addTodo
:
function
(
newTodo
)
{
newTodo
.
id
=
this
.
getUuid
();
this
.
todos
.
push
(
newTodo
);
this
.
todos
.
unshift
(
newTodo
);
this
.
todosModified
();
},
...
...
labs/architecture-examples/puremvc/js/view/component/TodoForm.js
View file @
15be3631
...
...
@@ -49,7 +49,8 @@ puremvc.define({
// INSTANCE MEMBERS
{
ENTER_KEY
:
13
,
ENTER_KEY
:
13
,
ESC_KEY
:
27
,
addEventListener
:
function
(
type
,
listener
,
useCapture
){
todomvc
.
view
.
event
.
AppEvents
.
addEventListener
(
this
.
todoApp
,
type
,
listener
,
useCapture
);
...
...
@@ -63,6 +64,18 @@ puremvc.define({
todomvc
.
view
.
event
.
AppEvents
.
dispatchEvent
(
this
.
todoApp
,
event
);
},
abandonEditTodo
:
function
(
event
)
{
var
todo
,
todoId
,
div
,
inputEditTodo
;
inputEditTodo
=
event
.
target
;
todoId
=
inputEditTodo
.
getAttribute
(
'
data-todo-id
'
)
todo
=
this
.
getTodoById
(
todoId
);
inputEditTodo
.
value
=
todo
.
title
;
inputEditTodo
.
completed
=
todo
.
completed
;
div
=
document
.
getElementById
(
'
li_
'
+
todoId
);
div
.
className
=
'
view
'
;
this
.
newTodoField
.
focus
();
},
dispatchToggleComplete
:
function
(
event
)
{
var
todo
,
toggleItemCompleteEvent
;
todo
=
this
.
getTodoById
(
event
.
target
.
getAttribute
(
'
data-todo-id
'
)
);
...
...
@@ -167,6 +180,7 @@ puremvc.define({
todoId
=
this
.
getAttribute
(
'
data-todo-id
'
);
div
=
document
.
getElementById
(
'
li_
'
+
todoId
);
inputEditTodo
=
document
.
getElementById
(
'
input_
'
+
todoId
);
inputEditTodo
.
setAttribute
(
'
data-todo-id
'
,
todoId
);
div
.
className
=
'
editing
'
;
inputEditTodo
.
focus
();
...
...
@@ -184,6 +198,13 @@ puremvc.define({
this
.
component
.
dispatchUpdateTodo
(
event
);
}
});
todomvc
.
view
.
event
.
AppEvents
.
addEventListener
(
inputEditTodo
,
'
keydown
'
,
function
(
event
)
{
if
(
event
.
keyCode
===
this
.
component
.
ESC_KEY
)
{
this
.
component
.
abandonEditTodo
(
event
);
}
});
todomvc
.
view
.
event
.
AppEvents
.
addEventListener
(
inputEditTodo
,
'
blur
'
,
function
(
event
)
{
this
.
component
.
dispatchUpdateTodo
(
event
);
});
...
...
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