Double click support for cloud side of project dialog

pull/3/merge
jmoenig 2013-04-22 16:34:01 +02:00
rodzic 39db95a414
commit 020f95992d
2 zmienionych plików z 28 dodań i 33 usunięć

57
gui.js
Wyświetl plik

@ -68,7 +68,7 @@ sb, CommentMorph, CommandBlockMorph*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.gui = '2013-April-21'; modules.gui = '2013-April-22';
// Declarations // Declarations
@ -3724,7 +3724,7 @@ ProjectDialogMorph.prototype.setSource = function (source) {
myself.ide.cloudError().call(null, err, lbl); myself.ide.cloudError().call(null, err, lbl);
} }
); );
break; return;
case 'local': case 'local':
this.projectList = this.getLocalProjectList(); this.projectList = this.getLocalProjectList();
break; break;
@ -3732,8 +3732,8 @@ ProjectDialogMorph.prototype.setSource = function (source) {
this.projectList = []; this.projectList = [];
break; break;
} }
this.listField.destroy();
this.listField.destroy();
this.listField = new ListMorph( this.listField = new ListMorph(
this.projectList, this.projectList,
this.projectList.length > 0 ? this.projectList.length > 0 ?
@ -3796,21 +3796,14 @@ ProjectDialogMorph.prototype.setSource = function (source) {
} }
this.body.add(this.listField); this.body.add(this.listField);
if (this.source === 'cloud') { this.shareButton.hide();
this.shareButton.show(); this.unshareButton.hide();
this.unshareButton.hide(); if (this.source === 'local') {
this.deleteButton.show(); this.deleteButton.show();
} else { } else { // examples
this.shareButton.hide(); this.deleteButton.hide();
this.unshareButton.hide();
if (this.source === 'local') {
this.deleteButton.show();
} else { // examples
this.deleteButton.hide();
}
} }
this.buttons.fixLayout(); this.buttons.fixLayout();
this.fixLayout(); this.fixLayout();
if (this.task === 'open') { if (this.task === 'open') {
this.clearDetails(); this.clearDetails();
@ -3858,10 +3851,8 @@ ProjectDialogMorph.prototype.installCloudProjectList = function (pl) {
function (proj) {return proj.Public === 'true'; } function (proj) {return proj.Public === 'true'; }
] ]
], ],
null,
function () {myself.ok(); } function () {myself.ok(); }
); );
this.fixListFieldItemColors(); this.fixListFieldItemColors();
this.listField.fixLayout = nop; this.listField.fixLayout = nop;
this.listField.edge = InputFieldMorph.prototype.edge; this.listField.edge = InputFieldMorph.prototype.edge;
@ -3896,6 +3887,10 @@ ProjectDialogMorph.prototype.installCloudProjectList = function (pl) {
myself.edit(); myself.edit();
}; };
this.body.add(this.listField); this.body.add(this.listField);
this.shareButton.show();
this.unshareButton.hide();
this.deleteButton.show();
this.buttons.fixLayout();
this.fixLayout(); this.fixLayout();
if (this.task === 'open') { if (this.task === 'open') {
this.clearDetails(); this.clearDetails();
@ -3912,36 +3907,32 @@ ProjectDialogMorph.prototype.clearDetails = function () {
}; };
ProjectDialogMorph.prototype.openProject = function () { ProjectDialogMorph.prototype.openProject = function () {
var myself = this; var myself = this,
proj = this.listField.selected;
if (!proj) {return; }
if (this.source === 'cloud') { if (this.source === 'cloud') {
if (this.listField.selected) { this.openCloudProject(proj);
this.openSelectedCloudProject();
}
} else { // 'local, examples' } else { // 'local, examples'
if (this.listField.selected) { myself.ide.source = 'local';
myself.ide.source = 'local'; this.ide.openProject(proj.name);
this.ide.openProject(this.listField.selected.name); this.destroy();
this.destroy();
}
} }
}; };
ProjectDialogMorph.prototype.openSelectedCloudProject = function () { ProjectDialogMorph.prototype.openCloudProject = function (project) {
var myself = this; var myself = this;
this.nextSteps([ myself.ide.nextSteps([
function () { function () {
myself.ide.showMessage('Fetching project\nfrom the cloud...'); myself.ide.showMessage('Fetching project\nfrom the cloud...');
}, },
function () { function () {
myself.rawOpenSelectedCloudProject(); myself.rawOpenCloudProject(project);
} }
]); ]);
}; };
ProjectDialogMorph.prototype.rawOpenSelectedCloudProject = function () { ProjectDialogMorph.prototype.rawOpenCloudProject = function (proj) {
var myself = this, var myself = this;
proj = this.listField.selected;
SnapCloud.reconnect( SnapCloud.reconnect(
function () { function () {
SnapCloud.callService( SnapCloud.callService(

Wyświetl plik

@ -1649,3 +1649,7 @@ ______
* using the percent character in variable names is now safe (fixes Github issue #65) * using the percent character in variable names is now safe (fixes Github issue #65)
* Morphic: added Doubleclick support, example: inspectors * Morphic: added Doubleclick support, example: inspectors
* GUI: Double clicking a project in the project dialog performs the dialog's action on it (open / save) * GUI: Double clicking a project in the project dialog performs the dialog's action on it (open / save)
130422
------
* GUI: Double clicking support for cloud side of project dialog