4831: "Backstage" browser client.
[arvados.git] / apps / backstage / app / base-ctrl.js
1 module.exports = BaseController;
2
3 var m = require('mithril');
4
5 BaseController.prototype.selectUuid =
6     function selectUuid(uuid) {
7         m.route('/show/' + uuid);
8     }
9 BaseController.prototype.onunload =
10     function onunload() {
11         var todo = [];
12         if (this.controllers instanceof Function) {
13             todo = this.controllers();
14         } else if (this.controllers instanceof Array) {
15             todo = this.controllers;
16         }
17         todo.map(function(ctrl) {
18             if (ctrl.onunload instanceof Function)
19                 ctrl.onunload();
20         });
21     }
22 function BaseController(vm) {
23     this.vm = vm;
24 }