szurubooru/static/js/controllers/users_controller.js
rr- 797ace982f start
Done so far

Basic backend skeleton

- technology choices
- database migration outline
- basic self hosting facade
- basic REST outline
- proof of concept for auth and privileges

Basic frontend skeleton

- technology choices
- pretty robust frontend compilation
- top navigation
- proof of concept for registration form
2016-03-27 23:05:10 +02:00

38 lines
1.1 KiB
JavaScript

'use strict';
class UsersController {
constructor(topNavigationController, authController, registrationView) {
this.topNavigationController = topNavigationController;
this.authController = authController;
this.registrationView = registrationView;
}
listUsersRoute() {
this.topNavigationController.activate('users');
}
createUserRoute() {
const self = this;
this.topNavigationController.activate('register');
this.registrationView.render({
onRegistered: (user) => {
alert(user);
self.authController.login(user);
}});
}
showUserRoute(user) {
if (this.authController.isLoggedIn() &&
user == this.authController.getCurrentUser().name) {
this.topNavigationController.activate('account');
} else {
this.topNavigationController.activate('users');
}
}
editUserRoute(user) {
this.topNavigationController.activate('users');
}
}
module.exports = UsersController;