Commit 7c80642e authored by James Thomas's avatar James Thomas

Merge pull request #3 from neonstalwart/tweaks

minor tweaks to code
parents 973b3c70 c4c8e3ee
......@@ -7,10 +7,7 @@
@import "./css/claro.css";
</style>
<link href="css/todos.css" media="all" rel="stylesheet" type="text/css"/>
<script data-dojo-config="async:true, parseOnLoad:true, paths:{'todo':'../../todo'}" src="./js/dtk/dojo/dojo.js"></script>
<script>
require(["dojo/parser", "todo/app"])
</script>
<script data-dojo-config="async:true, parseOnLoad:true, paths:{'todo':'../../todo'}, deps:['dojo/parser', 'todo/app']" src="./js/dtk/dojo/dojo.js"></script>
</head>
<body class="claro">
......
......@@ -9,7 +9,6 @@
<li data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: '#{this.index}'">
<div class="todo">
<input class="check" data-dojo-type="todo.form.CheckBox" data-dojo-props='ref: "isDone"' style="display:inline-block" >
</input>
<div class="todo-content dijitInline" data-dojo-type="dijit.InlineEditBox"
data-dojo-props='ref: "todo_text", editor:"dijit.form.TextBox", autosave:true, width:"420px", style:"width:420px;"'></div>
......
......@@ -94,8 +94,8 @@ define(["dojo/_base/declare",
* we a number of completed and incomplete todo items.
*/
onItemStatusUpdate: function () {
domClass[this.model.complete.value > 0 ? "add" : "remove" ](this.todo_stats, "items_selected");
domClass[this.model.todos.get("length") ? "add" : "remove" ](this.todo_stats, "items_present");
domClass.toggle(this.todo_stats, "items_selected", this.model.complete.value > 0);
domClass.toggle(this.todo_stats, "items_present", this.model.todos.get("length"));
},
/**
......
......@@ -88,13 +88,9 @@ define(["dojo/_base/declare", "dojox/mvc/StatefulModel", "todo/store/LocalStorag
* cause the bound "complete" value to be updated as well.
*/
updateTotalItemsLeft: function () {
var remaining = 0;
array.forEach(this.todos, function (item) {
item && !item.isDone.value && remaining++;
});
this.incomplete.set("value", remaining);
this.incomplete.set("value", array.filter(this.todos, function (item) {
return item && !item.isDone.value;
}).length);
}
});
});
......@@ -53,7 +53,7 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/json", "dojo/store/
// property if a specific id is to be used.
// returns: Number
var id = options && options.id || object[this.idProperty] || Math.random();
localStorage.setItem(id,dojo.toJson(object));
localStorage.setItem(id, json.toJson(object));
return id;
},
add: function(object, options){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment