kopia lustrzana https://github.com/backface/turtlestitch
move cloud menu and add reset password link
rodzic
343e2cced1
commit
66e5dc2112
|
@ -370,29 +370,6 @@ IDE_Morph.prototype.createControlBar = function () {
|
||||||
this.controlBar.add(settingsButton);
|
this.controlBar.add(settingsButton);
|
||||||
this.controlBar.settingsButton = settingsButton; // for menu positioning
|
this.controlBar.settingsButton = settingsButton; // for menu positioning
|
||||||
|
|
||||||
// cloudButton
|
|
||||||
button = new PushButtonMorph(
|
|
||||||
this,
|
|
||||||
'cloudMenu',
|
|
||||||
new SymbolMorph('cloud', 11)
|
|
||||||
);
|
|
||||||
button.corner = 12;
|
|
||||||
button.color = colors[0];
|
|
||||||
button.highlightColor = colors[1];
|
|
||||||
button.pressColor = colors[2];
|
|
||||||
button.labelMinExtent = new Point(36, 18);
|
|
||||||
button.padding = 0;
|
|
||||||
button.labelShadowOffset = new Point(-1, -1);
|
|
||||||
button.labelShadowColor = colors[1];
|
|
||||||
button.labelColor = this.buttonLabelColor;
|
|
||||||
button.contrast = this.buttonContrast;
|
|
||||||
button.drawNew();
|
|
||||||
// button.hint = 'cloud operations';
|
|
||||||
button.fixLayout();
|
|
||||||
cloudButton = button;
|
|
||||||
this.controlBar.add(cloudButton);
|
|
||||||
this.controlBar.cloudButton = cloudButton; // for menu positioning
|
|
||||||
|
|
||||||
this.controlBar.fixLayout = function () {
|
this.controlBar.fixLayout = function () {
|
||||||
x = this.right() - padding;
|
x = this.right() - padding;
|
||||||
[stopButton, pauseButton, startButton].forEach(
|
[stopButton, pauseButton, startButton].forEach(
|
||||||
|
@ -424,11 +401,8 @@ IDE_Morph.prototype.createControlBar = function () {
|
||||||
settingsButton.setCenter(myself.controlBar.center());
|
settingsButton.setCenter(myself.controlBar.center());
|
||||||
settingsButton.setLeft(this.left());
|
settingsButton.setLeft(this.left());
|
||||||
|
|
||||||
cloudButton.setCenter(myself.controlBar.center());
|
|
||||||
cloudButton.setRight(settingsButton.left() - padding);
|
|
||||||
|
|
||||||
projectButton.setCenter(myself.controlBar.center());
|
projectButton.setCenter(myself.controlBar.center());
|
||||||
projectButton.setRight(cloudButton.left() - padding);
|
projectButton.setRight(settingsButton.left() - padding);
|
||||||
|
|
||||||
this.refreshSlider();
|
this.refreshSlider();
|
||||||
this.updateLabel();
|
this.updateLabel();
|
||||||
|
@ -1589,6 +1563,131 @@ IDE_Morph.prototype.projectMenu = function () {
|
||||||
},
|
},
|
||||||
'Select categories of additional blocks to add to this project.'
|
'Select categories of additional blocks to add to this project.'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
menu.addLine();
|
||||||
|
|
||||||
|
if (shiftClicked) {
|
||||||
|
menu.addItem(
|
||||||
|
'Cloud url...',
|
||||||
|
'setCloudURL',
|
||||||
|
null,
|
||||||
|
new Color(100, 0, 0)
|
||||||
|
);
|
||||||
|
menu.addLine();
|
||||||
|
}
|
||||||
|
if (!SnapCloud.username) {
|
||||||
|
menu.addItem(
|
||||||
|
'Login',
|
||||||
|
function () { window.open('/login'); }
|
||||||
|
);
|
||||||
|
menu.addItem(
|
||||||
|
'Create an account',
|
||||||
|
function () { window.open('/signup'); }
|
||||||
|
);
|
||||||
|
menu.addItem(
|
||||||
|
'Reset Password...',
|
||||||
|
function () { window.open('/forgot_password'); }
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
menu.addItem(
|
||||||
|
localize('Logout') + ' / ' + SnapCloud.username,
|
||||||
|
'logout'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (shiftClicked) {
|
||||||
|
menu.addLine();
|
||||||
|
menu.addItem(
|
||||||
|
'export project media only...',
|
||||||
|
function () {
|
||||||
|
if (myself.projectName) {
|
||||||
|
myself.exportProjectMedia(myself.projectName);
|
||||||
|
} else {
|
||||||
|
myself.prompt('Export Project As...', function (name) {
|
||||||
|
myself.exportProjectMedia(name);
|
||||||
|
}, null, 'exportProject');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
this.hasChangedMedia ? new Color(100, 0, 0) : new Color(0, 100, 0)
|
||||||
|
);
|
||||||
|
menu.addItem(
|
||||||
|
'export project without media...',
|
||||||
|
function () {
|
||||||
|
if (myself.projectName) {
|
||||||
|
myself.exportProjectNoMedia(myself.projectName);
|
||||||
|
} else {
|
||||||
|
myself.prompt('Export Project As...', function (name) {
|
||||||
|
myself.exportProjectNoMedia(name);
|
||||||
|
}, null, 'exportProject');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
new Color(100, 0, 0)
|
||||||
|
);
|
||||||
|
menu.addItem(
|
||||||
|
'export project as cloud data...',
|
||||||
|
function () {
|
||||||
|
if (myself.projectName) {
|
||||||
|
myself.exportProjectAsCloudData(myself.projectName);
|
||||||
|
} else {
|
||||||
|
myself.prompt('Export Project As...', function (name) {
|
||||||
|
myself.exportProjectAsCloudData(name);
|
||||||
|
}, null, 'exportProject');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
new Color(100, 0, 0)
|
||||||
|
);
|
||||||
|
menu.addLine();
|
||||||
|
menu.addItem(
|
||||||
|
'open shared project from cloud...',
|
||||||
|
function () {
|
||||||
|
myself.prompt('Author name…', function (usr) {
|
||||||
|
myself.prompt('Project name...', function (prj) {
|
||||||
|
var id = 'Username=' +
|
||||||
|
encodeURIComponent(usr.toLowerCase()) +
|
||||||
|
'&ProjectName=' +
|
||||||
|
encodeURIComponent(prj);
|
||||||
|
myself.showMessage(
|
||||||
|
'Fetching project\nfrom the cloud...'
|
||||||
|
);
|
||||||
|
SnapCloud.getPublicProject(
|
||||||
|
id,
|
||||||
|
function (projectData) {
|
||||||
|
var msg;
|
||||||
|
if (!Process.prototype.isCatchingErrors) {
|
||||||
|
window.open(
|
||||||
|
'data:text/xml,' + projectData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
myself.nextSteps([
|
||||||
|
function () {
|
||||||
|
msg = myself.showMessage(
|
||||||
|
'Opening project...'
|
||||||
|
);
|
||||||
|
},
|
||||||
|
function () {nop(); }, // yield (Chrome)
|
||||||
|
function () {
|
||||||
|
myself.rawOpenCloudDataString(
|
||||||
|
projectData
|
||||||
|
);
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
msg.destroy();
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
myself.cloudError()
|
||||||
|
);
|
||||||
|
|
||||||
|
}, null, 'project');
|
||||||
|
}, null, 'project');
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
new Color(100, 0, 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
menu.popup(world, pos);
|
menu.popup(world, pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1024,7 +1024,19 @@ ProjectDialogMorph.prototype.rawOpenCloudProject = function (proj) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// gui.js
|
||||||
|
|
||||||
|
IDE_Morph.prototype.cloudMenu = function () {
|
||||||
|
var menu,
|
||||||
|
myself = this,
|
||||||
|
world = this.world(),
|
||||||
|
pos = this.controlBar.cloudButton.bottomLeft(),
|
||||||
|
shiftClicked = (world.currentKey === 16);
|
||||||
|
|
||||||
|
menu = new MenuMorph(this);
|
||||||
|
menu.popup(world, pos);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
// store.js
|
// store.js
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue