summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/gui.js b/gui.js
index f01f19d..f53d597 100644
--- a/gui.js
+++ b/gui.js
@@ -4865,6 +4865,7 @@ ProjectDialogMorph.prototype.deleteProject = function () {
ProjectDialogMorph.prototype.shareProject = function () {
var myself = this,
+ ide = this.siblings()[0],
proj = this.listField.selected,
entry = this.listField.active;
@@ -4895,6 +4896,15 @@ ProjectDialogMorph.prototype.shareProject = function () {
myself.ide.cloudError(),
[proj.ProjectName]
);
+ // Set the Shared URL if the project is currently open
+ if (proj.ProjectName === ide.projectName) {
+ var usr = SnapCloud.username,
+ projectId = 'Username=' +
+ encodeURIComponent(usr.toLowerCase()) +
+ '&ProjectName=' +
+ encodeURIComponent(ide.projectName);
+ location.hash = projectId;
+ }
},
myself.ide.cloudError()
);
@@ -4905,6 +4915,7 @@ ProjectDialogMorph.prototype.shareProject = function () {
ProjectDialogMorph.prototype.unshareProject = function () {
var myself = this,
+ ide = this.siblings()[0],
proj = this.listField.selected,
entry = this.listField.active;
@@ -4936,6 +4947,10 @@ ProjectDialogMorph.prototype.unshareProject = function () {
myself.ide.cloudError(),
[proj.ProjectName]
);
+ // Remove the shared URL if the project is open.
+ if (proj.ProjectName === ide.projectName) {
+ location.hash = '';
+ }
},
myself.ide.cloudError()
);