Commit 737caf7a authored by Thibaut Frain's avatar Thibaut Frain

correction of page routing

parent 98eee053
...@@ -72,21 +72,24 @@ ...@@ -72,21 +72,24 @@
}) })
.allowPublicAcquisition('publishConnectionState', function (options) { .allowPublicAcquisition('publishConnectionState', function (options) {
var state = options[0], var gadget = this,
saved_options; state = options[0],
came_from;
if (state === "connected") { if (state === "connected") {
if (this.props.after_connect_options !== undefined) { if (this.props.came_from !== undefined) {
saved_options = this.props.after_connect_options; came_from = this.props.came_from;
delete this.props.after_connect_options; delete this.props.came_from;
return this.aq_pleasePublishMyState(saved_options) return this.aq_pleasePublishMyState(came_from)
.push(this.pleaseRedirectMyHash.bind(this)); .push(function () {
} gadget.render(came_from);
if (window.location.hash !== "#page=connection") { });
return this.aq_pleasePublishMyState({page: "contactlist"})
.push(this.pleaseRedirectMyHash.bind(this));
} }
return this.aq_pleasePublishMyState({page: "contactlist"})
.push(this.pleaseRedirectMyHash.bind(this));
} }
return this.aq_pleasePublishMyState({page: "connection"})
.push(this.pleaseRedirectMyHash.bind(this));
}) })
.declareMethod('getConnectionJID', function () { .declareMethod('getConnectionJID', function () {
...@@ -156,7 +159,6 @@ ...@@ -156,7 +159,6 @@
page_element; page_element;
element = gadget.__element.querySelector(".gadget-container"); element = gadget.__element.querySelector(".gadget-container");
return this.getDeclaredGadget("connection") return this.getDeclaredGadget("connection")
.push(function (connection_gadget) { .push(function (connection_gadget) {
return connection_gadget.isConnected(); return connection_gadget.isConnected();
...@@ -164,17 +166,17 @@ ...@@ -164,17 +166,17 @@
.push(function (is_connected) { .push(function (is_connected) {
// default page // default page
if (options.page === undefined) { if (options.page === undefined) {
options.page = "contactlist"; return gadget.aq_pleasePublishMyState({page: "contactlist"})
.push(gadget.pleaseRedirectMyHash.bind(gadget));
} }
if (!is_connected && options.page !== "connection") { if (!is_connected && options.page !== "connection") {
gadget.props.after_connect_options = options; gadget.props.came_from = options;
return gadget.getDeclaredGadget("connection") return gadget.getDeclaredGadget("connection")
.push(function (connection_gadget) { .push(function (connection_gadget) {
return connection_gadget.pleaseConnectMe(); return connection_gadget.pleaseConnectMe();
}); });
} }
return gadget.getDeclaredGadget(options.page) return gadget.getDeclaredGadget(options.page)
.push(function (g) { .push(function (g) {
page_gadget = g; page_gadget = g;
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
Object.keys(params).length === 3) { Object.keys(params).length === 3) {
return loopConnectionListener(this, params); return loopConnectionListener(this, params);
} }
return this.pleaseRedirectMyHash("#page=connection"); return this.publishConnectionState("disconnected");
}) })
.ready(function (g) { .ready(function (g) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment