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
89c59e10
Commit
89c59e10
authored
Mar 28, 2013
by
Peter Michaux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow escape key to end edit mode of a todo
parent
7bd29bc5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
architecture-examples/maria/src/js/controllers/TodoController.js
...cture-examples/maria/src/js/controllers/TodoController.js
+7
-1
architecture-examples/maria/src/js/util.js
architecture-examples/maria/src/js/util.js
+4
-0
architecture-examples/maria/src/js/views/TodoView.js
architecture-examples/maria/src/js/views/TodoView.js
+5
-1
No files found.
architecture-examples/maria/src/js/controllers/TodoController.js
View file @
89c59e10
...
...
@@ -13,9 +13,15 @@ maria.Controller.subclass(checkit, 'TodoController', {
this
.
getView
().
showEdit
();
},
onKeyupEdit
:
function
(
evt
)
{
if
(
checkit
.
isEnterKeyCode
(
evt
.
keyCode
))
{
var
keyCode
=
evt
.
keyCode
;
if
(
checkit
.
isEnterKeyCode
(
keyCode
))
{
this
.
onBlurEdit
();
}
else
if
(
checkit
.
isEscapeKeyCode
(
keyCode
))
{
var
view
=
this
.
getView
();
view
.
resetEdit
();
view
.
showDisplay
();
}
},
onBlurEdit
:
function
()
{
var
model
=
this
.
getModel
();
...
...
architecture-examples/maria/src/js/util.js
View file @
89c59e10
...
...
@@ -16,3 +16,7 @@ checkit.escapeHTML = function(str) {
checkit
.
isEnterKeyCode
=
function
(
keyCode
)
{
return
keyCode
===
13
;
};
checkit
.
isEscapeKeyCode
=
function
(
keyCode
)
{
return
keyCode
===
27
;
};
architecture-examples/maria/src/js/views/TodoView.js
View file @
89c59e10
...
...
@@ -24,9 +24,13 @@ maria.ElementView.subclass(checkit, 'TodoView', {
update
:
function
()
{
this
.
buildData
();
},
show
Edit
:
function
()
{
reset
Edit
:
function
()
{
var
input
=
this
.
find
(
'
.edit
'
);
input
.
value
=
this
.
getModel
().
getTitle
();
},
showEdit
:
function
()
{
this
.
resetEdit
();
var
input
=
this
.
find
(
'
.edit
'
);
aristocrat
.
addClass
(
this
.
find
(
'
li
'
),
'
editing
'
);
input
.
focus
();
},
...
...
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