From 45083627c35d6ed1f6f6d23349233aa8b6996807 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sun, 8 Jul 2012 21:47:35 -0400 Subject: [PATCH] Removing the demo stuff. I'm tracking commits on codeparty/derby now, don't need this --- src/app/demo.coffee | 66 -------------------------------------------- styles/app/demo.styl | 20 -------------- 2 files changed, 86 deletions(-) delete mode 100644 src/app/demo.coffee delete mode 100644 styles/app/demo.styl diff --git a/src/app/demo.coffee b/src/app/demo.coffee deleted file mode 100644 index a0161fe406..0000000000 --- a/src/app/demo.coffee +++ /dev/null @@ -1,66 +0,0 @@ -{get, view, ready} = require('derby').createApp module - -## ROUTES ## - -start = +new Date() - -# Derby routes can be rendered on the client and the server -get '/:roomName?', (page, model, {roomName}) -> - roomName ||= 'home' - - # Subscribes the model to any updates on this room's object. Calls back - # with a scoped model equivalent to: - # room = model.at "rooms.#{roomName}" - model.subscribe "rooms.#{roomName}", (err, room) -> - model.ref '_room', room - - # setNull will set a value if the object is currently null or undefined - room.setNull 'welcome', "Welcome to #{roomName}!" - - room.incr 'visits' - - # This value is set for when the page initially renders - model.set '_timer', '0.0' - # Reset the counter when visiting a new route client-side - start = +new Date() - - # Render will use the model data as well as an optional context object - page.render - roomName: roomName - randomUrl: parseInt(Math.random() * 1e9).toString(36) - - -## CONTROLLER FUNCTIONS ## - -ready (model) -> - timer = null - - # Expose the model as a global variable in the browser. This is fun in - # development, but it should be removed when writing an app - window.model = model - - # Exported functions are exposed as a global in the browser with the same - # name as the module that includes Derby. They can also be bound to DOM - # events using the "x-bind" attribute in a template. - exports.stop = -> - - # Any path name that starts with an underscore is private to the current - # client. Nothing set under a private path is synced back to the server. - model.set '_stopped', true - clearInterval timer - - do exports.start = -> - model.set '_stopped', false - timer = setInterval -> - model.set '_timer', (((+new Date()) - start) / 1000).toFixed(1) - , 100 - - - model.set '_showReconnect', true - exports.connect = -> - # Hide the reconnect link for a second after clicking it - model.set '_showReconnect', false - setTimeout (-> model.set '_showReconnect', true), 1000 - model.socket.socket.connect() - - exports.reload = -> window.location.reload() diff --git a/styles/app/demo.styl b/styles/app/demo.styl deleted file mode 100644 index 6c064f7150..0000000000 --- a/styles/app/demo.styl +++ /dev/null @@ -1,20 +0,0 @@ -@import "../base"; - -#alert { - position: absolute; - text-align: center; - top: 0; - left: 0; - width: 100%; - height: 0; - z-index: 99; -} -#alert > p { - background: #fff1a8; - border: 1px solid #999; - border-top: 0; - border-radius: 0 0 3px 3px; - display: inline-block; - line-height: 21px; - padding: 0 12px; -}