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
e659901d
Commit
e659901d
authored
Jan 02, 2012
by
Sindre Sorhus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switched from jQuery-tmpl to handlebars.js
Since jQuery-tmpl is depricated
parent
fb92c298
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1570 additions
and
18 deletions
+1570
-18
todo-example/jquery/index.html
todo-example/jquery/index.html
+18
-15
todo-example/jquery/js/app.js
todo-example/jquery/js/app.js
+2
-3
todo-example/jquery/js/handlebars-1.0.0.beta.6.js
todo-example/jquery/js/handlebars-1.0.0.beta.6.js
+1550
-0
No files found.
todo-example/jquery/index.html
View file @
e659901d
<!doctype html>
<html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
>
<title>
jQuery
</title>
<link
rel=
"stylesheet"
href=
"css/app.css"
>
<script
src=
"js/json2.js"
></script>
<script
src=
"js/jquery.min.js"
></script>
<script
src=
"js/
jquery.tmpl
.js"
></script>
<script
src=
"js/
handlebars-1.0.0.beta.6
.js"
></script>
<script
src=
"js/app.js"
></script>
<script
type=
"text/x-jquery-tmpl"
id=
"todo-template"
>
<
li
class
=
"
item {{if done}}done{{/if}}
"
data
-
id
=
"
${id}
"
>
<
div
class
=
"
view
"
title
=
"
Double click to edit...
"
>
<
input
type
=
"
checkbox
"
{{
if
done
}}
checked
=
"
checked
"
{{
/if}}>
<
span
>
$
{
title
}
<
/span
>
<
a
class
=
"
destroy
"
><
/a
>
<
/div
>
<
div
class
=
"
edit
"
>
<
input
type
=
"
text
"
value
=
"
${title}
"
>
<
/div
>
<
/li
>
</script>
</head>
<body>
<div
id=
"todoapp"
>
...
...
@@ -32,11 +21,25 @@
<div
class=
"count"
></div>
</footer>
</div>
<div
id=
'instructions'
>
<div
id=
"instructions"
>
Double-click to edit a todo.
</div>
<div
id=
"credits"
>
Created by
<a
href=
"http://sindresorhus.com"
>
Sindre Sorhus
</a>
.
</div>
<script
type=
"text/x-handlebars-template"
id=
"todo-template"
>
{{
#
this
}}
<
li
class
=
"
item {{#if done}}done{{/if}}
"
data
-
id
=
"
{{id}}
"
>
<
div
class
=
"
view
"
title
=
"
Double click to edit...
"
>
<
input
type
=
"
checkbox
"
{{
#
if
done
}}
checked
=
"
checked
"
{{
/if}}
>
<
span
>
{{
title
}}
<
/span
>
<
a
class
=
"
destroy
"
><
/a
>
<
/div
>
<
div
class
=
"
edit
"
>
<
input
type
=
"
text
"
value
=
"
{{title}}
"
>
<
/div
>
<
/li
>
{{
/
this
}}
</script>
</body>
</html>
\ No newline at end of file
todo-example/jquery/js/app.js
View file @
e659901d
...
...
@@ -33,7 +33,7 @@ jQuery(function($) {
this
.
render
();
},
cacheElements
:
function
()
{
this
.
$template
=
$
(
'
#todo-template
'
);
this
.
template
=
Handlebars
.
compile
(
$
(
'
#todo-template
'
).
html
()
);
this
.
$todoApp
=
$
(
'
#todoapp
'
);
this
.
$todoList
=
this
.
$todoApp
.
find
(
'
.items
'
);
this
.
$footer
=
this
.
$todoApp
.
find
(
'
footer
'
);
...
...
@@ -60,8 +60,7 @@ jQuery(function($) {
list
.
on
(
'
click
'
,
'
.destroy
'
,
this
.
destroy
);
},
render
:
function
()
{
var
html
=
this
.
$template
.
tmpl
(
this
.
todos
);
this
.
$todoList
.
html
(
html
);
this
.
$todoList
.
html
(
this
.
template
(
this
.
todos
)
);
this
.
renderFooter
();
this
.
store
(
this
.
todos
);
},
...
...
todo-example/jquery/js/handlebars-1.0.0.beta.6.js
0 → 100644
View file @
e659901d
This diff is collapsed.
Click to expand it.
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