kopia lustrzana https://github.com/backface/turtlestitch
Merge pull request #624 from cycomachead/shared-url
Set location.hash to cloud URLs on project sharespull/3/merge
commit
253d800b42
15
gui.js
15
gui.js
|
@ -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()
|
||||
);
|
||||
|
|
Ładowanie…
Reference in New Issue