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
4f3802f4
Commit
4f3802f4
authored
Jul 21, 2012
by
Clarence Leung
Committed by
Sindre Sorhus
Jul 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close GH-222: Update for YUI 3.6.0. Fixes #211
parent
88494910
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
478 additions
and
522 deletions
+478
-522
architecture-examples/yuilibrary/css/app.css
architecture-examples/yuilibrary/css/app.css
+0
-4
architecture-examples/yuilibrary/index.html
architecture-examples/yuilibrary/index.html
+64
-25
architecture-examples/yuilibrary/js/app.js
architecture-examples/yuilibrary/js/app.js
+234
-477
architecture-examples/yuilibrary/js/models/todo.js
architecture-examples/yuilibrary/js/models/todo.js
+38
-0
architecture-examples/yuilibrary/js/models/todolist.js
architecture-examples/yuilibrary/js/models/todolist.js
+42
-0
architecture-examples/yuilibrary/js/views/todoview.js
architecture-examples/yuilibrary/js/views/todoview.js
+100
-0
architecture-examples/yuilibrary/js/yui-3.4.0.min.js
architecture-examples/yuilibrary/js/yui-3.4.0.min.js
+0
-16
No files found.
architecture-examples/yuilibrary/css/app.css
deleted
100644 → 0
View file @
88494910
#main
,
#footer
{
display
:
none
;
}
\ No newline at end of file
architecture-examples/yuilibrary/index.html
View file @
4f3802f4
...
...
@@ -3,45 +3,84 @@
<head>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
>
<title>
YUI • TodoMVC
</title>
<link
rel=
"stylesheet"
href=
"../../assets/base.css"
>
<link
rel=
"stylesheet"
href=
"css/app.css"
>
<!--[if IE]>
<script src="../../assets/ie.js"></script>
<![endif]-->
<title>
YUI 3.6.0
</title>
<link
rel=
"stylesheet"
href=
"../../assets/base.css"
/>
</head>
<body>
<section
id=
"todoapp"
>
<header
id=
"header"
>
<h1>
todos
</h1>
<h1>
Todos
</h1>
<input
id=
"new-todo"
placeholder=
"What needs to be done?"
autofocus
>
</header>
<input
id=
"new-todo"
placeholder=
"What needs to be done?"
autofocus
>
<section
id=
"main"
>
<input
id=
"toggle-all"
type=
"checkbox"
>
<label
for=
"toggle-all"
>
Mark all as complete
</label>
<ul
id=
"todo-list"
></ul>
</section>
<footer
id=
"footer"
></
footer
>
<footer
id=
"footer"
></
div
>
</section>
<footer
id=
"info"
>
<p>
Based on code by the YUILibrary team
</p>
<p>
Created by
<a
href=
"https://github.com/addyosmani"
>
Addy Osmani
</a></p>
<p>
Rewrite by
<a
href=
"https://github.com/sindresorhus"
>
Sindre Sorhus
</a></p>
<div
id=
"info"
>
<p>
Double-click to edit a todo
</p>
<p>
Part of
<a
href=
"http://todomvc.com"
>
TodoMVC
</a></p>
</footer>
<script
type=
"text/x-template"
id=
"todo-template"
>
<script
type=
"text/x-handlebars-template"
id=
"item-template"
>
<
div
class
=
"
view
"
>
<
input
class
=
"
toggle
"
type
=
"
checkbox
"
{
completed
}
>
<
label
>
{
title
}
<
/label
>
<
input
class
=
"
toggle
"
type
=
"
checkbox
"
{
{
#
if
completed
}}
checked
=
"
checked
"
{{
/if}} /
>
<
label
>
{
{
title
}
}
<
/label
>
<
button
class
=
"
destroy
"
><
/button
>
<
/div
>
<
input
class
=
"
edit
"
value
=
"
{title}
"
>
<
input
class
=
"
edit
"
type
=
"
text
"
value
=
"
{{title}}
"
/
>
</script>
<script
type=
"text/x-template"
id=
"footer-template"
>
<
span
id
=
"
todo-count
"
><
strong
>
{
numRemaining
}
<
/strong> {remainingLabel} left</
span
>
<
button
id
=
"
clear-completed
"
>
Clear
completed
({
numCompleted
})
<
/button
>
<script
type=
"text/x-handlebars-template"
id=
"stats-template"
>
<
span
id
=
"
todo-count
"
><
strong
>
{{
remaining
}}
<
/strong> {{pluralize remaining "item"}} left</
span
>
<
ul
id
=
"
filters
"
>
<
li
>
<
a
class
=
"
selected
"
href
=
"
#/
"
>
All
<
/a
>
<
/li
>
<
li
>
<
a
href
=
"
#/active
"
>
Active
<
/a
>
<
/li
>
<
li
>
<
a
href
=
"
#/completed
"
>
Completed
<
/a
>
<
/li
>
<
/ul
>
{{
#
if
completed
}}
<
button
id
=
"
clear-completed
"
>
Clear
completed
({{
completed
}})
<
/button
>
{{
/
if
}}
</script>
<script
src=
"../../assets/base.js"
></script>
<script
src=
"js/yui-3.4.0.min.js"
></script>
<script
src=
"js/app.js"
></script>
</body>
</html>
\ No newline at end of file
<script
src=
"http://yui.yahooapis.com/3.6.0pr4/build/yui/yui-min.js"
></script>
<script>
YUI
({
filter
:
'
raw
'
,
allowRollup
:
'
false
'
,
groups
:
{
'
todo-mvc
'
:
{
base
:
'
./js/
'
,
modules
:
{
'
todo
'
:
{
path
:
'
models/todo.js
'
,
requires
:
[
'
gallery-model-sync-local
'
,
'
model
'
]
},
'
todo-list
'
:
{
path
:
'
models/todolist.js
'
,
requires
:
[
'
gallery-model-sync-local
'
,
'
model-list
'
,
'
todo
'
]
},
'
todo-view
'
:
{
path
:
'
views/todoview.js
'
,
requires
:
[
'
view
'
,
'
handlebars
'
]
},
'
todo-app
'
:
{
path
:
'
app.js
'
,
requires
:
[
'
app
'
,
'
todo-list
'
,
'
todo-view
'
]
}
}
}
}
}).
use
(
'
todo-app
'
,
function
(
Y
)
{
var
app
=
new
Y
.
TodoMVC
.
TodoApp
();
});
</script>
</body>
</html>
architecture-examples/yuilibrary/js/app.js
View file @
4f3802f4
This diff is collapsed.
Click to expand it.
architecture-examples/yuilibrary/js/models/todo.js
0 → 100644
View file @
4f3802f4
YUI
.
add
(
'
todo
'
,
function
(
Y
)
{
"
use strict
"
;
// -- Todo Model -------------
var
Todo
=
Y
.
Base
.
create
(
'
todo
'
,
Y
.
Model
,
[
Y
.
ModelSync
.
Local
],
{
// Set up the root localStorage key we save our Model data in.
root
:
'
todos-yui
'
,
// Toggle the completed state of the Todo.
toggle
:
function
()
{
this
.
save
({
completed
:
!
this
.
get
(
'
completed
'
)});
},
// Destroy this Todo and remove it from localStorage.
clear
:
function
()
{
this
.
destroy
({
remove
:
true
});
}
},
{
// Default attributes.
ATTRS
:
{
title
:
{
value
:
'
empty todo ...
'
},
completed
:
{
value
:
false
}
}
});
// Set this Model under our custom Y.MVC namespace.
Y
.
namespace
(
'
TodoMVC
'
).
Todo
=
Todo
;
},
'
@VERSION@
'
,
{
requires
:
[
'
gallery-model-sync-local
'
,
'
model
'
]
});
architecture-examples/yuilibrary/js/models/todolist.js
0 → 100644
View file @
4f3802f4
YUI
.
add
(
'
todo-list
'
,
function
(
Y
)
{
"
use strict
"
;
// Dependencies from Y.MVC.
var
Todo
=
Y
.
TodoMVC
.
Todo
,
TodoList
;
// -- TodoList Model list -----
TodoList
=
Y
.
Base
.
create
(
'
todoList
'
,
Y
.
ModelList
,
[
Y
.
ModelSync
.
Local
],
{
// The related Model for our Model List.
model
:
Todo
,
// The root used for our localStorage key.
root
:
'
todos-yui
'
,
// Return a ModelList of our completed Models.
completed
:
function
()
{
return
this
.
filter
({
asList
:
true
},
function
(
todo
)
{
return
todo
.
get
(
'
completed
'
);
});
},
// Return an ModelList of our un-completed Models.
remaining
:
function
()
{
return
this
.
filter
({
asList
:
true
},
function
(
todo
)
{
return
!
todo
.
get
(
'
completed
'
);
});
}
});
// Set this Model List under our custom Y.MVC namespace.
Y
.
namespace
(
'
TodoMVC
'
).
TodoList
=
TodoList
;
},
'
@VERSION@
'
,
{
requires
:
[
'
gallery-model-sync-local
'
,
'
model-list
'
,
'
todo
'
]
});
architecture-examples/yuilibrary/js/views/todoview.js
0 → 100644
View file @
4f3802f4
YUI
.
add
(
'
todo-view
'
,
function
(
Y
)
{
"
use strict
"
;
// -- Todo View -------------------
var
TodoView
=
Y
.
Base
.
create
(
'
todoView
'
,
Y
.
View
,
[],
{
// The container element that the View is rendered under.
containerTemplate
:
'
<li>
'
,
// Compile our template using Handlebars.
template
:
Y
.
Handlebars
.
compile
(
Y
.
one
(
'
#item-template
'
).
getHTML
()),
// Bind DOM events for handling changes to a specific Todo,
// for completion and editing.
events
:
{
'
.toggle
'
:
{
click
:
'
toggleComplete
'
},
'
.view
'
:
{
dblclick
:
'
edit
'
},
'
.edit
'
:
{
blur
:
'
close
'
,
keypress
:
'
enterUpdate
'
},
'
.destroy
'
:
{
click
:
'
clear
'
}
},
// Initialize this view by setting event handlers when the Model
// is updated or destroyed.
initializer
:
function
()
{
var
model
=
this
.
get
(
'
model
'
);
model
.
after
(
'
change
'
,
this
.
render
,
this
);
},
// Render this view in our <li> container, and fill it with the
// data in our Model.
render
:
function
()
{
var
container
=
this
.
get
(
'
container
'
),
model
=
this
.
get
(
'
model
'
);
container
.
setHTML
(
this
.
template
(
model
.
toJSON
()));
container
.
toggleClass
(
'
completed
'
,
model
.
get
(
'
completed
'
));
this
.
set
(
'
inputNode
'
,
container
.
one
(
'
.edit
'
));
return
this
;
},
// Toggle the linked Todo's completion status.
toggleComplete
:
function
()
{
this
.
get
(
'
model
'
).
toggle
();
},
// Turn on editing mode for the Todo by exposing the input field.
edit
:
function
()
{
this
.
get
(
'
container
'
).
addClass
(
'
editing
'
);
this
.
get
(
'
inputNode
'
).
focus
();
},
// Get the value from our input field while hiding it, and
// save it to our Todo when focus is lost from the field.
close
:
function
(
e
)
{
var
value
=
this
.
get
(
'
inputNode
'
).
get
(
'
value
'
),
editedValue
=
Y
.
Escape
.
html
(
Y
.
Lang
.
trim
(
value
));
this
.
get
(
'
container
'
).
removeClass
(
'
editing
'
);
if
(
editedValue
)
{
this
.
get
(
'
model
'
).
save
({
title
:
editedValue
});
}
else
{
this
.
clear
();
}
},
// Also allow updating the Todo's text through the enter key.
enterUpdate
:
function
(
e
)
{
var
ENTER_KEY
=
13
;
if
(
e
.
keyCode
===
ENTER_KEY
)
{
this
.
close
();
}
},
// Destroy the model when the delete button is clicked.
clear
:
function
(
e
)
{
this
.
get
(
'
model
'
).
clear
();
}
});
// Set this View under our custom Y.TodoMVC namespace.
Y
.
namespace
(
'
TodoMVC
'
).
TodoView
=
TodoView
;
},
'
@VERSION@
'
,
{
requires
:
[
'
view
'
,
'
handlebars
'
]
});
architecture-examples/yuilibrary/js/yui-3.4.0.min.js
deleted
100644 → 0
View file @
88494910
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