Skip to content

Instantly share code, notes, and snippets.

@ConradIrwin
Created January 26, 2015 17:55
Show Gist options
  • Save ConradIrwin/d7dc518cadca621f2e8a to your computer and use it in GitHub Desktop.
Save ConradIrwin/d7dc518cadca621f2e8a to your computer and use it in GitHub Desktop.
# <body data-controller="dashboard/errors" data-action="index">
# -> dashboard/errors/index -> ErrorsIndex
pageClass = () ->
path = $('body').data('controller') + "/" + $('body').data('action')
className = path.replace(/(?:^(?:dashboard\/)?|\/)(.)/g, (m, l) -> l.toUpperCase())
return window[className]
$ ->
if Klass = pageClass()
new Klass($('body'))
$("body").bugsnagBehavior()
# An angular module for the dashboard.
# Depends on 'templates' from angular-rails-templates.
# Depends on 'ng-rails'csrf' for csrf protection.
@Dashboard = angular.module('dashboard', ['templates', 'ng-rails-csrf', 'angular.ujs', 'ngAnimate'])
Reflux.ActionMethods.alert = (x) ->
Reflux.ActionMethods.implement = (callback) ->
@listenAndPromise =>
@_running = callback.apply(this, arguments)
Reflux.ActionMethods.triggerPromise = ->
@trigger.apply(this, arguments)
@_running
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment