Permalink
Browse files

magic things

  • Loading branch information...
rashfael committed Jan 20, 2013
1 parent d48895c commit df5abd2e02cd36a6eaf1798812a8ff47e50f8912
View
@@ -11,62 +11,62 @@ require 'lib/iosync'
# The application object # The application object
module.exports = class Application extends Chaplin.Application module.exports = class Application extends Chaplin.Application
# Set your application name here so the document title is set to # Set your application name here so the document title is set to
# “Controller title – Site title” (see Layout#adjustTitle) # “Controller title – Site title” (see Layout#adjustTitle)
title: 'Shack Karma' title: 'Shack Karma'
serverUrl: 'http://localhost:9000/' serverUrl: 'http://localhost:9000/'
initialize: -> initialize: ->
super super
# Initialize core components # Initialize core components
@initDispatcher() @initDispatcher()
@initLayout() @initLayout()
@initMediator() @initMediator()
#@initRouter() #@initRouter()
@router = new Router() @router = new Router()
@initSocket -> @initSocket ->
auth = new AuthenticationController() auth = new AuthenticationController()
mediator.subscribe '!auth:success', => mediator.subscribe '!auth:success', =>
@initControllers() @initControllers()
# register routes late # register routes late
routes @router.match routes @router.match
@router.startHistory() @router.startHistory()
#mediator.publish '!router:route', '' #mediator.publish '!router:route', ''
Object.freeze? this Object.freeze? this
# Override standard layout initializer # Override standard layout initializer
# ------------------------------------ # ------------------------------------
initLayout: -> initLayout: ->
# Use an application-specific Layout class. Currently this adds # Use an application-specific Layout class. Currently this adds
# no features to the standard Chaplin Layout, it’s an empty placeholder. # no features to the standard Chaplin Layout, it’s an empty placeholder.
@layout = new Layout {@title} @layout = new Layout {@title}
# Instantiate common controllers # Instantiate common controllers
# ------------------------------ # ------------------------------
initControllers: -> initControllers: ->
# These controllers are active during the whole application runtime. # These controllers are active during the whole application runtime.
# You don’t need to instantiate all controllers here, only special # You don’t need to instantiate all controllers here, only special
# controllers which do not to respond to routes. They may govern models # controllers which do not to respond to routes. They may govern models
# and views which are needed the whole time, for example header, footer # and views which are needed the whole time, for example header, footer
# or navigation views. # or navigation views.
# e.g. new NavigationController() # e.g. new NavigationController()
# new SessionController() # new SessionController()
new HeaderController() new HeaderController()
new FooterController() new FooterController()
# Create additional mediator properties # Create additional mediator properties
# ------------------------------------- # -------------------------------------
initMediator: -> initMediator: ->
# Create a user property # Create a user property
Chaplin.mediator.user = null Chaplin.mediator.user = null
# Add additional application-specific properties and methods # Add additional application-specific properties and methods
# Seal the mediator # Seal the mediator
# Chaplin.mediator.seal() # Chaplin.mediator.seal()
initSocket: (cb) => initSocket: (cb) =>
socket = io.connect @serverUrl socket = io.connect @serverUrl
Backbone.socket = socket Backbone.socket = socket
socket.on 'connect', cb socket.on 'connect', cb
@@ -1,5 +1,6 @@
thead thead
tr tr
th Name th Name
th Karma Points
th Description th Description
tbody tbody
@@ -6,6 +6,7 @@ include mixins/form_helpers
form.form-horizontal form.form-horizontal
fieldset fieldset
mixin textfield({name:'name', label:'Name'}) mixin textfield({name:'name', label:'Name'})
mixin textfield({name:'karma', label:'Karma Points'})
mixin textarea({name:'description', label:'Description'}) mixin textarea({name:'description', label:'Description'})
.form-actions .form-actions
button.btn.btn-primary Save button.btn.btn-primary Save
@@ -1,3 +1,4 @@
.page-header .page-header
h1= 'Deed ' + name h1= 'Deed ' + name
h4= 'Karma Points: ' + karma
p= description p= description
@@ -1,2 +1,3 @@
td= name td= name
td= karma
td= description td= description
View
@@ -5,5 +5,6 @@ Schema = mongoose.Schema
schema = new Schema schema = new Schema
name: String name: String
description: String description: String
karma: Number
module.exports = mongoose.model 'Deed', schema, 'deeds' module.exports = mongoose.model 'Deed', schema, 'deeds'

0 comments on commit df5abd2

Please sign in to comment.