Skip to content

Commit

Permalink
Merge branch 'reorg42' of https://github.com/foxdonut/meiosis-examples
Browse files Browse the repository at this point in the history
…into reorg42
  • Loading branch information
foxdonut committed May 7, 2016
2 parents 5107407 + 8a67b01 commit dacb9ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions todomvc/common/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

ref.todoStorage = {
loadAll: function() {
return JSON.parse(localStorage.getItem(STORAGE_KEY) ||
"[{\"id\":1,\"title\":\"meiosis\",\"completed\":false}]");
return JSON.parse(localStorage.getItem(STORAGE_KEY) || "[]");
},
saveTodo: function(todo) {
var todos = ref.todoStorage.loadAll();
Expand Down
9 changes: 3 additions & 6 deletions todomvc/vanillajs/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
};

var main = function(model, _actions) {
// FIXME
var renderedTodos = (model.todos || []).map(renderTodo).join("");
var renderedTodos = model.todos.map(renderTodo).join("");

return " <section class='main'>" +
" <input class='toggle-all' type='checkbox'>" +
Expand Down Expand Up @@ -38,11 +37,9 @@
};

var footer = function(model) {
// FIXME
var todos = (model.todos || []);
var notCompleted = function(todo) { return !todo.completed; };
var itemsLeft = todos.filter(notCompleted).length;
var itemsLeftText = todos.length > 0 ?
var itemsLeft = model.todos.filter(notCompleted).length;
var itemsLeftText = model.todos.length > 0 ?
(String(itemsLeft) + " item" + (itemsLeft === 1 ? "" : "s") + " left") : "";

return " <footer class='footer'>" +
Expand Down

0 comments on commit dacb9ce

Please sign in to comment.