send database to mini login

This commit is contained in:
Adam Abrons 2010-01-12 09:34:27 -08:00
parent fac0e698a8
commit 19bbee030b
2 changed files with 4 additions and 3 deletions

View file

@ -1,8 +1,9 @@
// Copyright (C) 2008,2009 BRAT Tech LLC // Copyright (C) 2008,2009 BRAT Tech LLC
nglr.ControlBar = function (document, serverUrl) { nglr.ControlBar = function (document, serverUrl, database) {
this.document = document; this.document = document;
this.serverUrl = serverUrl; this.serverUrl = serverUrl;
this.database = database;
this.window = window; this.window = window;
this.callbacks = []; this.callbacks = [];
}; };
@ -21,7 +22,7 @@ nglr.ControlBar.HTML =
nglr.ControlBar.prototype.login = function (loginSubmitFn) { nglr.ControlBar.prototype.login = function (loginSubmitFn) {
this.callbacks.push(loginSubmitFn); this.callbacks.push(loginSubmitFn);
if (this.callbacks.length == 1) { if (this.callbacks.length == 1) {
this.doTemplate("/user_session/new.mini?return_url=" + encodeURIComponent(this.urlWithoutAnchor())); this.doTemplate("/user_session/new.mini?database="+encodeURIComponent(this.database)+"&return_url=" + encodeURIComponent(this.urlWithoutAnchor()));
} }
}; };

View file

@ -213,7 +213,7 @@ nglr.Loader.prototype.bindHtml = function() {
var widgetFactory = new nglr.WidgetFactory(this.config.server, this.config.database); var widgetFactory = new nglr.WidgetFactory(this.config.server, this.config.database);
var binder = new nglr.Binder(document[0], widgetFactory, watcher, this.config); var binder = new nglr.Binder(document[0], widgetFactory, watcher, this.config);
widgetFactory.onChangeListener = nglr.shiftBind(binder, binder.updateModel); widgetFactory.onChangeListener = nglr.shiftBind(binder, binder.updateModel);
var controlBar = new nglr.ControlBar(document.find('body'), this.config.server); var controlBar = new nglr.ControlBar(document.find('body'), this.config.server, this.config.database);
var onUpdate = function(){binder.updateView();}; var onUpdate = function(){binder.updateView();};
var server = this.config.database=="$MEMORY" ? var server = this.config.database=="$MEMORY" ?
new nglr.FrameServer(this.window) : new nglr.FrameServer(this.window) :