Created
July 31, 2014 20:55
-
-
Save stillinbeta/e36bb36af0324e3013b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root = exports ? this | |
log.enableAll() | |
Rearview = new Backbone.Marionette.Application() | |
root.Rearview = Rearview | |
# Interpolating to zero can have bad side-effects: | |
# https://github.com/mbostock/d3/wiki/Transitions#wiki-d3_interpolateNumber | |
Rearview.zeroish = 1e-6 | |
Rearview.addRegions({ | |
global: '#global' | |
}) | |
Rearview.on('initialize:before', (options) -> | |
Backbone.Marionette.TemplateCache.prototype.compileTemplate = | |
(template) -> | |
return Handlebars.compile(template) | |
momentformatDefaults = { | |
tzid: 'UTC' | |
format: 'ddd DD MMM HH:mm' | |
} | |
myRouter = Backbone.Router.extend | |
routes: { | |
"(/)": "test", | |
"dashboard": "dashboard", | |
"dashboard/:team/:week/:alert_levels/:time": "dashboard" | |
} | |
test: -> | |
log.debug("routed, son") | |
dashboard: (team, week, alert_levels, time) -> | |
log.debug("team: #{team}, week: #{week}, alert_levels: #{alert_levels}, time: #{time}") | |
Handlebars.registerHelper('momentformat', (utcdatestring, options) -> | |
_.defaults(options.hash, momentformatDefaults) | |
d = moment.utc(utcdatestring) | |
if options.hash.tzid != 'UTC' | |
d = d.tz(options.hash.tzid) | |
return d.format(options.hash.format) | |
) | |
Handlebars.registerHelper('autolink', (text) -> | |
return new Handlebars.SafeString(Autolinker.link(text, | |
{'email': false, 'twitter': false, 'stripPrefix': false})) | |
) | |
Swag.registerHelpers(Handlebars) | |
) | |
Rearview.on('start', (options) -> | |
log.debug("Rearview starting…") | |
Backbone.history.start() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment