diff options
| author | Michael Ball <cycomachead@gmail.com> | 2014-10-25 02:03:12 -0700 |
|---|---|---|
| committer | Michael Ball <cycomachead@gmail.com> | 2014-10-25 02:03:12 -0700 |
| commit | 9e5fb9a4cba980c977d4e11e5c9a4e7f9c8596db (patch) | |
| tree | 215325c0172dfd5c8d361f79500557953e30d136 | |
| parent | 5f3279990be3478fde79b94f7dbd5d7da80df84b (diff) | |
| download | snap-9e5fb9a4cba980c977d4e11e5c9a4e7f9c8596db.tar.gz snap-9e5fb9a4cba980c977d4e11e5c9a4e7f9c8596db.zip | |
Set location.hash to cloud URLs on project shares
This will make it much easier to get the URL for a shared project.
It also removes the # from the URL when the open project is unshared."
| -rw-r--r-- | gui.js | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -4864,6 +4864,7 @@ ProjectDialogMorph.prototype.deleteProject = function () { ProjectDialogMorph.prototype.shareProject = function () { var myself = this, + ide = this.siblings()[0], proj = this.listField.selected, entry = this.listField.active; @@ -4894,6 +4895,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() ); @@ -4904,6 +4914,7 @@ ProjectDialogMorph.prototype.shareProject = function () { ProjectDialogMorph.prototype.unshareProject = function () { var myself = this, + ide = this.siblings()[0], proj = this.listField.selected, entry = this.listField.active; @@ -4935,6 +4946,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() ); |
