Commit 43737b1a authored by James Thomas's avatar James Thomas

Fixing showing and hiding of page elements on items selected

parent 6dc4577e
#clear-completed, #footer, #main {
display: none;
}
#todoapp.todos_selected #clear-completed,
#todoapp.todos_present #footer,
#todoapp.todos_present #main {
display: inherit;
}
#todo-list li .toggle.dijitChecked:after { #todo-list li .toggle.dijitChecked:after {
color: #85ada7; color: #85ada7;
text-shadow: 0 1px 0 #669991; text-shadow: 0 1px 0 #669991;
...@@ -5,7 +15,6 @@ ...@@ -5,7 +15,6 @@
position: relative; position: relative;
} }
/* When checkbox is selected, score through todo item content */ /* When checkbox is selected, score through todo item content */
.dijitCheckBoxChecked + .todo-content { .dijitCheckBoxChecked + .todo-content {
color: #666; color: #666;
......
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
</head> </head>
<body class="claro"> <body class="claro">
<section id="todoapp" data-dojo-type="todo.app"></section> <section id="todoapp" data-dojo-type="todo.app"></section>
<div id="credits"> <footer id="info">
Created by <a href="http://jamesthom.as/">James Thomas</a> and <a href="https://github.com/edchat">Ed Chatelain</a> <p>Double-click to edit a todo</p>
</div> <p>Created by <a href="http://jamesthom.as/">James Thomas</a> and <a href="https://github.com/edchat">Ed Chatelain</a></p>
</footer>
<script src="../../assets/base.js"></script> <script src="../../assets/base.js"></script>
<script data-dojo-config="async:true, parseOnLoad:true, locale:'en', paths:{'todo':'/code/JavaScript/todomvc/architecture-examples/dojo/js/todo/'}, deps:['dojo/parser', 'todo/app']" src="/code/JavaScript/Libraries/DTK/dojo-release-1.7.2-src/dojo/dojo.js"></script> <script data-dojo-config="async:true, parseOnLoad:true, locale:'en', paths:{'todo':'/code/JavaScript/todomvc/architecture-examples/dojo/js/todo/'}, deps:['dojo/parser', 'todo/app']" src="/code/JavaScript/Libraries/DTK/dojo-release-1.7.2-src/dojo/dojo.js"></script>
</body> </body>
......
...@@ -22,10 +22,7 @@ ...@@ -22,10 +22,7 @@
</ul> </ul>
</section> </section>
<!-- This footer should hidden by default and shown when there are todos -->
<footer id="footer" data-dojo-attach-point="todo_stats"> <footer id="footer" data-dojo-attach-point="todo_stats">
<!-- This should be `0 items left` by default -->
<span id="todo-count"> <span id="todo-count">
<strong> <strong>
<span data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: this.model.incomplete" class="number"></span> <span data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: this.model.incomplete" class="number"></span>
......
...@@ -6,12 +6,14 @@ define(["dojo/_base/declare", ...@@ -6,12 +6,14 @@ define(["dojo/_base/declare",
// Parent classes // Parent classes
"dijit/_WidgetBase", "dijit/_TemplatedMixin", "dijit/_WidgetsInTemplateMixin", "dijit/_WidgetBase", "dijit/_TemplatedMixin", "dijit/_WidgetsInTemplateMixin",
// General application modules // General application modules
"dojo/_base/lang", "dojo/_base/event", "dojo/on", "dojo/dom-class", "dojo/dom-attr", "dojox/mvc", "todo/model/TodoModel", "dojo/_base/lang", "dojo/_base/event", "dojo/on", "dojo/dom-class", "dojo/dom-attr",
"dojo/keys", "dojox/mvc", "todo/model/TodoModel",
// Widget template // Widget template
"dojo/text!./app.html", "dojo/text!./app.html",
// Template Widgets // Template Widgets
"dijit/InlineEditBox", "todo/form/CheckBox", "dojox/mvc/Group", "dojox/mvc/Repeat", "dojox/mvc/Output"], "dijit/InlineEditBox", "todo/form/CheckBox", "dojox/mvc/Group", "dojox/mvc/Repeat", "dojox/mvc/Output"],
function(declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, lang, _event, on, domClass, domAttr, mvc, TodoModel, template) { function(declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, lang, _event, on, domClass, domAttr,
keys, mvc, TodoModel, template) {
return declare("todo.app", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], { return declare("todo.app", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
templateString: template, templateString: template,
...@@ -94,8 +96,8 @@ define(["dojo/_base/declare", ...@@ -94,8 +96,8 @@ define(["dojo/_base/declare",
* we a number of completed and incomplete todo items. * we a number of completed and incomplete todo items.
*/ */
onItemStatusUpdate: function () { onItemStatusUpdate: function () {
domClass.toggle(this.todo_stats, "items_selected", this.model.complete.value > 0); domClass.toggle(this.domNode, "todos_selected", this.model.complete.value > 0);
domClass.toggle(this.todo_stats, "items_present", this.model.todos.get("length")); domClass.toggle(this.domNode, "todos_present", this.model.todos.get("length"));
}, },
/** /**
...@@ -104,7 +106,7 @@ define(["dojo/_base/declare", ...@@ -104,7 +106,7 @@ define(["dojo/_base/declare",
* text value as new todo item in the model. * text value as new todo item in the model.
*/ */
onKeyPress: function (event) { onKeyPress: function (event) {
if (event.keyCode !== 13) return; if (event.keyCode !== keys.ENTER) return;
this.addToModel(event.target.value, false); this.addToModel(event.target.value, false);
event.target.value = ""; event.target.value = "";
......
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