Fix todomvc to reflect All/Active/Completed choice
This commit is contained in:
parent
8388cedad8
commit
7c5e06d2ec
1 changed files with 6 additions and 6 deletions
|
|
@ -97,7 +97,7 @@ var Todos = {
|
||||||
m("input#toggle-all[type='checkbox']", {checked: state.remaining === 0, onclick: ui.toggleAll}),
|
m("input#toggle-all[type='checkbox']", {checked: state.remaining === 0, onclick: ui.toggleAll}),
|
||||||
m("label[for='toggle-all']", {onclick: ui.toggleAll}, "Mark all as complete"),
|
m("label[for='toggle-all']", {onclick: ui.toggleAll}, "Mark all as complete"),
|
||||||
m("ul#todo-list", [
|
m("ul#todo-list", [
|
||||||
state.todos.map(function(todo) {
|
state.todosByStatus.map(function(todo) {
|
||||||
return m("li", {class: (todo.completed ? "completed" : "") + " " + (todo === state.editing ? "editing" : "")}, [
|
return m("li", {class: (todo.completed ? "completed" : "") + " " + (todo === state.editing ? "editing" : "")}, [
|
||||||
m(".view", [
|
m(".view", [
|
||||||
m("input.toggle[type='checkbox']", {checked: todo.completed, onclick: function() {ui.toggle(todo)}}),
|
m("input.toggle[type='checkbox']", {checked: todo.completed, onclick: function() {ui.toggle(todo)}}),
|
||||||
|
|
@ -115,9 +115,9 @@ var Todos = {
|
||||||
state.remaining === 1 ? " item left" : " items left",
|
state.remaining === 1 ? " item left" : " items left",
|
||||||
]),
|
]),
|
||||||
m("ul#filters", [
|
m("ul#filters", [
|
||||||
m("li", m("a[href='/']", {oncreate: m.route.link, class: state.filter === "" ? "selected" : ""}, "All")),
|
m("li", m("a[href='/']", {oncreate: m.route.link, class: state.showing === "" ? "selected" : ""}, "All")),
|
||||||
m("li", m("a[href='/active']", {oncreate: m.route.link, class: state.filter === "active" ? "selected" : ""}, "Active")),
|
m("li", m("a[href='/active']", {oncreate: m.route.link, class: state.showing === "active" ? "selected" : ""}, "Active")),
|
||||||
m("li", m("a[href='/completed']", {oncreate: m.route.link, class: state.filter === "completed" ? "selected" : ""}, "Completed")),
|
m("li", m("a[href='/completed']", {oncreate: m.route.link, class: state.showing === "completed" ? "selected" : ""}, "Completed")),
|
||||||
]),
|
]),
|
||||||
m("button#clear-completed", {onclick: function() {state.dispatch("clear")}}, "Clear completed"),
|
m("button#clear-completed", {onclick: function() {state.dispatch("clear")}}, "Clear completed"),
|
||||||
]) : null,
|
]) : null,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue