Created
July 15, 2012 08:44
-
-
Save jankuca/3115947 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
var darkside = require('darkside'); | |
var DashboardController = function (users) { | |
darkside.base(darkside.ViewController, this); | |
this.$users = users; | |
}; | |
require('util').inherits(DashboardController, darkside.ViewController); | |
DashboardController.prototype.$deps = ['users']; | |
darkside.extend(DashboardController.prototype, { | |
init: function (done) { | |
this.bearcms_session_key = this.$request.cookies['bearcms_session_key'] || null; | |
this.bearcms_username= this.$request.cookies['bearcms_username'] || null; | |
if (this.bearcms_session_key == null || this.bearcms_username == null) { | |
return this.redirectTo('backend:sign:login'); | |
} | |
this.view['bearcms_session_key'] = this.bearcms_session_key; | |
this.view['bearcms_username'] = this.bearcms_username; | |
done(); | |
}, | |
'index': function (params) { | |
this.$users.all(null, function (err, users) { | |
if (err) { | |
this.response.end(503); | |
} else { | |
this.view['users'] = users; | |
this.render(); | |
} | |
}, this); | |
}, | |
}); | |
module.exports = DashboardController; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment