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
ba3a573b
Commit
ba3a573b
authored
Dec 31, 2011
by
Aaron Boushley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating the template to use the content it has present.
parent
57c83b0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
14 deletions
+5
-14
todo-example/backbone_require/js/templates/todos.html
todo-example/backbone_require/js/templates/todos.html
+2
-2
todo-example/backbone_require/js/views/todos.js
todo-example/backbone_require/js/views/todos.js
+3
-12
No files found.
todo-example/backbone_require/js/templates/todos.html
View file @
ba3a573b
<div
class=
"todo <%= done ? 'done' : '' %>"
>
<div
class=
"todo <%= done ? 'done' : '' %>"
>
<div
class=
"display"
>
<div
class=
"display"
>
<input
class=
"check"
type=
"checkbox"
<%=
done
?
'
checked=
"checked"
'
:
''
%
>
/>
<input
class=
"check"
type=
"checkbox"
<%=
done
?
'
checked=
"checked"
'
:
''
%
>
/>
<div
class=
"todo-content"
></div>
<div
class=
"todo-content"
><
%=
content
%
><
/div>
<span
class=
"todo-destroy"
></span>
<span
class=
"todo-destroy"
></span>
</div>
</div>
<div
class=
"edit"
>
<div
class=
"edit"
>
<input
class=
"todo-input"
type=
"text"
value=
""
/>
<input
class=
"todo-input"
type=
"text"
value=
"
<%= content %>
"
/>
</div>
</div>
</div>
</div>
todo-example/backbone_require/js/views/todos.js
View file @
ba3a573b
...
@@ -17,7 +17,8 @@ define([
...
@@ -17,7 +17,8 @@ define([
"
click .check
"
:
"
toggleDone
"
,
"
click .check
"
:
"
toggleDone
"
,
"
dblclick div.todo-content
"
:
"
edit
"
,
"
dblclick div.todo-content
"
:
"
edit
"
,
"
click span.todo-destroy
"
:
"
clear
"
,
"
click span.todo-destroy
"
:
"
clear
"
,
"
keypress .todo-input
"
:
"
updateOnEnter
"
"
keypress .todo-input
"
:
"
updateOnEnter
"
,
"
blur .todo-input
"
:
"
close
"
},
},
// The TodoView listens for changes to its model, re-rendering. Since there's
// The TodoView listens for changes to its model, re-rendering. Since there's
...
@@ -32,18 +33,8 @@ define([
...
@@ -32,18 +33,8 @@ define([
// Re-render the contents of the todo item.
// Re-render the contents of the todo item.
render
:
function
()
{
render
:
function
()
{
$
(
this
.
el
).
html
(
this
.
template
(
this
.
model
.
toJSON
()));
$
(
this
.
el
).
html
(
this
.
template
(
this
.
model
.
toJSON
()));
this
.
setContent
();
return
this
;
},
// To avoid XSS (not that it would be harmful in this particular app),
// we use `jQuery.text` to set the contents of the todo item.
setContent
:
function
()
{
var
content
=
this
.
model
.
get
(
'
content
'
);
this
.
$
(
'
.todo-content
'
).
text
(
content
);
this
.
input
=
this
.
$
(
'
.todo-input
'
);
this
.
input
=
this
.
$
(
'
.todo-input
'
);
this
.
input
.
bind
(
'
blur
'
,
this
.
close
);
return
this
;
this
.
input
.
val
(
content
);
},
},
// Toggle the `"done"` state of the model.
// Toggle the `"done"` state of the model.
...
...
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