Commit 633a99f2 authored by Sindre Sorhus's avatar Sindre Sorhus

Derby app improvements

- Update dependencies
- Improve readme
- Convert to tabs
- Code style
- CSS simplification
- Quotes
- and more
parent fdc05921
# Derby.js TodoMVC app # Derby TodoMVC app
> MVC framework making it easy to write realtime, collaborative applications that run in both Node.js and browsers.
[Website](http://derbyjs.com)
## Getting started ## Getting started
[NodeJS](http://nodejs.org) (>= 0.8.0) is required to run this app. [Node.js](http://nodejs.org) (>=0.8.0) is required to run this app.
### Run the app
## Run the app
`make run` `make run`
This will install the dependencies locally, compile the coffeescript and run This will install the dependencies locally, compile the CoffeScript and run
the demo server for you. the demo server for you.
## Play with the code
In one window, run `make` which will continue to compile the coffeescript as
you save changes. In a separate window run `node server.js` and open up the
shown URL.
### Play with the code
## TODO In one window, run `make` which will continue to compile the CoffeScript as
* PROBLEM: Add ie.js - I've added the include to the template, but it you save changes. In a separate window run `node server.js` and open up the
obviously gets stripped out due to the comments, plus Nate mentioned that shown URL.
there's work needing to be done for ie < 10.
* QUESTION: Check with derby folk whether there's a better way to do the filtering while still using a route, and other improvements.
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
"name": "todomvc-derby", "name": "todomvc-derby",
"description": "TodoMVC todo app using Derby", "description": "TodoMVC todo app using Derby",
"version": "0.1.0", "version": "0.1.0",
"main": "./server.js", "main": "server.js",
"dependencies": { "dependencies": {
"derby": "0.3.13", "derby": "~0.3.13",
"express": "3.0.0beta4", "express": "~3.0.1",
"gzippo": ">=0.1.4" "gzippo": "~0.2.0"
}, },
"private": true,
"devDependencies": { "devDependencies": {
"coffee-script": ">=1.3.1" "coffee-script": "~1.4.0"
} },
"private": true
} }
...@@ -42,17 +42,9 @@ ...@@ -42,17 +42,9 @@
text-decoration: line-through; text-decoration: line-through;
} }
section.empty-list, footer.empty-list { section.empty-list, footer.empty-list,
display: none; section.empty-list #toggle-all,
} button#clear-completed.non-completed,
section.empty-list #toggle-all {
display: none;
}
button#clear-completed.non-completed {
display: none;
}
#todo-list li.editing input.toggle, #todo-list li.editing input.toggle,
#todo-list li.editing button.destroy { #todo-list li.editing button.destroy {
display: none; display: none;
......
exports.connect = function() { exports.connect = function() {
model = this.model var model = this.model;
// Hide the reconnect link for a second after clicking it // Hide the reconnect link for a second after clicking it
model.set('hideReconnect', true) model.set('hideReconnect', true);
setTimeout(function() { setTimeout(function() {
model.set('hideReconnect', false) model.set('hideReconnect', false);
}, 1000) }, 1000);
model.socket.socket.connect() model.socket.socket.connect();
} };
exports.reload = function() { exports.reload = function() {
window.location.reload() window.location.reload();
} };
var config = { function ui(derby, options) {
filename: __filename derby.createLibrary({
, styles: '../styles/ui' filename: __filename,
, scripts: { styles: '../styles/ui',
scripts: {
connectionAlert: require('./connectionAlert') connectionAlert: require('./connectionAlert')
} }
}; }, options);
module.exports = ui
ui.decorate = 'derby'
function ui(derby, options) {
derby.createLibrary(config, options)
} }
module.exports = ui;
ui.decorate = 'derby';
<Head:> <Head:>
<link href=/base.css rel=stylesheet> <link href="/base.css" rel="stylesheet">
<Title:> <Title:>
DerbyJS • TodoMVC DerbyJS • TodoMVC
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<section id="main" class="{#unless _list.shown}empty-list{/}"> <section id="main" class="{#unless _list.shown}empty-list{/}">
<input id="toggle-all" type="checkbox" checked="{noItems(_list.active)}" x-bind=click:clickToggleAll> <input id="toggle-all" type="checkbox" checked="{noItems(_list.active)}" x-bind=click:clickToggleAll>
<label for="toggle-all">Mark all as complete</label> <label for="toggle-all">Mark all as complete</label>
<ul id=todo-list>{#each _list.shown}<app:todo>{/}</ul> <ul id="todo-list">{#each _list.shown}<app:todo>{/}</ul>
</section> </section>
<app:todoFooter> <app:todoFooter>
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
<todoHeader:> <todoHeader:>
<header id="header"> <header id="header">
<h1>todos</h1> <h1>todos</h1>
<form x-bind=submit:add><input id="new-todo" placeholder="What needs to be done?" autofocus value={_newTodo}></form> <form x-bind=submit:add><input id="new-todo" placeholder="What needs to be done?" value={_newTodo} autofocus></form>
</header> </header>
<todo:> <todo:>
<li data-id={{id}} class="{#if .completed}completed{else}active{/}{#if ._editing} editing{/}"> <li data-id={{id}} class="{#if .completed}completed{else}active{/}{#if ._editing} editing{/}">
<div> <div>
<input class="toggle" type="checkbox" checked={.completed}> <input class="toggle" type="checkbox" checked="{.completed}">
<form x-bind=submit:submitEdit> <form x-bind=submit:submitEdit>
<input class="text" x-bind="focus:startEdit, blur:endEdit" value="{.text}"> <input class="text" x-bind="focus:startEdit, blur:endEdit" value="{.text}">
</form> </form>
...@@ -59,9 +59,8 @@ ...@@ -59,9 +59,8 @@
<info:> <info:>
<footer id="info"> <footer id="info">
<h3>Open this <a href="/{{_groupName}}">ToDo list</a> in another browser, or share it with a friend to collaborate!</h3> <h3>Open this <a href="/{{_groupName}}">app</a> in another browser, or share it with a friend to collaborate!</h3>
<p>Click on a todo to edit</p> <p>Click on a todo to edit</p>
<p>Template by <a href="http://github.com/sindresorhus">Sindre Sorhus</a></p>
<p>Created by <a href="http://micknelson.wordpress.com">Michael Nelson</a> and <a href="https://github.com/lackac">László Bácsi</a></p> <p>Created by <a href="http://micknelson.wordpress.com">Michael Nelson</a> and <a href="https://github.com/lackac">László Bácsi</a></p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p> <p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer> </footer>
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