Merge pull request #624 from cycomachead/shared-url

Set location.hash to cloud URLs on project shares
pull/3/merge
Jens Mönig 2015-06-25 16:32:45 +02:00
commit 253d800b42
1 zmienionych plików z 15 dodań i 0 usunięć

15
gui.js
Wyświetl plik

@ -5005,6 +5005,7 @@ ProjectDialogMorph.prototype.deleteProject = function () {
ProjectDialogMorph.prototype.shareProject = function () {
var myself = this,
ide = this.ide,
proj = this.listField.selected,
entry = this.listField.active;
@ -5035,6 +5036,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(proj.projectName);
location.hash = projectId;
}
},
myself.ide.cloudError()
);
@ -5045,6 +5055,7 @@ ProjectDialogMorph.prototype.shareProject = function () {
ProjectDialogMorph.prototype.unshareProject = function () {
var myself = this,
ide = this.ide,
proj = this.listField.selected,
entry = this.listField.active;
@ -5076,6 +5087,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()
);