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
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 @@
...
@@ -9,7 +9,8 @@
TaskApp
.
prototype
.
elements
=
{
TaskApp
.
prototype
.
elements
=
{
'
.items
'
:
'
tasks
'
,
'
.items
'
:
'
tasks
'
,
'
.countVal
'
:
'
counter
'
,
'
.countVal
'
:
'
counter
'
,
'
a.clear
'
:
'
clearCompleted
'
'
a.clear
'
:
'
clearCompleted
'
,
'
form#new-task input[name=name]
'
:
'
newTaskName
'
};
};
TaskApp
.
prototype
.
events
=
{
TaskApp
.
prototype
.
events
=
{
...
@@ -31,7 +32,8 @@
...
@@ -31,7 +32,8 @@
TaskApp
.
prototype
[
"
new
"
]
=
function
(
e
)
{
TaskApp
.
prototype
[
"
new
"
]
=
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
return
Task
.
fromForm
(
'
form#new-task
'
).
save
();
Task
.
fromForm
(
'
form#new-task
'
).
save
();
return
this
.
newTaskName
.
val
(
''
);
};
};
TaskApp
.
prototype
.
renderNew
=
function
(
task
)
{
TaskApp
.
prototype
.
renderNew
=
function
(
task
)
{
...
...
todo-example/spine/src/app.coffee
View file @
7d56ad3f
class
TaskApp
extends
Spine
.
Controller
class
TaskApp
extends
Spine
.
Controller
elements
:
elements
:
'.items'
:
'tasks'
'.items'
:
'tasks'
'.countVal'
:
'counter'
'.countVal'
:
'counter'
'a.clear'
:
'clearCompleted'
'a.clear'
:
'clearCompleted'
'form#new-task input[name=name]'
:
'newTaskName'
events
:
events
:
'submit form#new-task'
:
'new'
'submit form#new-task'
:
'new'
'click a.clear'
:
'clearCompleted'
'click a.clear'
:
'clearCompleted'
constructor
:
->
constructor
:
->
super
super
...
@@ -19,6 +20,7 @@ class TaskApp extends Spine.Controller
...
@@ -19,6 +20,7 @@ class TaskApp extends Spine.Controller
new
:
(
e
)
->
new
:
(
e
)
->
e
.
preventDefault
()
e
.
preventDefault
()
Task
.
fromForm
(
'form#new-task'
).
save
()
Task
.
fromForm
(
'form#new-task'
).
save
()
@
newTaskName
.
val
(
''
)
renderNew
:
(
task
)
=>
renderNew
:
(
task
)
=>
view
=
new
Tasks
(
task
:
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