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
7d56ad3f
Commit
7d56ad3f
authored
Dec 15, 2011
by
Fred Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear the input text field after adding a new entry
parent
d95b22b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
todo-example/spine/js/app.js
todo-example/spine/js/app.js
+4
-2
todo-example/spine/src/app.coffee
todo-example/spine/src/app.coffee
+7
-5
No files found.
todo-example/spine/js/app.js
View file @
7d56ad3f
...
...
@@ -9,7 +9,8 @@
TaskApp
.
prototype
.
elements
=
{
'
.items
'
:
'
tasks
'
,
'
.countVal
'
:
'
counter
'
,
'
a.clear
'
:
'
clearCompleted
'
'
a.clear
'
:
'
clearCompleted
'
,
'
form#new-task input[name=name]
'
:
'
newTaskName
'
};
TaskApp
.
prototype
.
events
=
{
...
...
@@ -31,7 +32,8 @@
TaskApp
.
prototype
[
"
new
"
]
=
function
(
e
)
{
e
.
preventDefault
();
return
Task
.
fromForm
(
'
form#new-task
'
).
save
();
Task
.
fromForm
(
'
form#new-task
'
).
save
();
return
this
.
newTaskName
.
val
(
''
);
};
TaskApp
.
prototype
.
renderNew
=
function
(
task
)
{
...
...
todo-example/spine/src/app.coffee
View file @
7d56ad3f
class
TaskApp
extends
Spine
.
Controller
elements
:
'.items'
:
'tasks'
'.countVal'
:
'counter'
'a.clear'
:
'clearCompleted'
'.items'
:
'tasks'
'.countVal'
:
'counter'
'a.clear'
:
'clearCompleted'
'form#new-task input[name=name]'
:
'newTaskName'
events
:
'submit form#new-task'
:
'new'
'click a.clear'
:
'clearCompleted'
'submit form#new-task'
:
'new'
'click a.clear'
:
'clearCompleted'
constructor
:
->
super
...
...
@@ -19,6 +20,7 @@ class TaskApp extends Spine.Controller
new
:
(
e
)
->
e
.
preventDefault
()
Task
.
fromForm
(
'form#new-task'
).
save
()
@
newTaskName
.
val
(
''
)
renderNew
:
(
task
)
=>
view
=
new
Tasks
(
task
:
task
)
...
...
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