When the workspace is empty, make it easy for the user to add a new group of blocks to it.

This commit is contained in:
Sean Lip
2016-11-22 15:53:45 -08:00
parent a66d274169
commit 5c79d2f36f
4 changed files with 131 additions and 102 deletions

View File

@@ -41,7 +41,12 @@ blocklyApp.WorkspaceComponent = ng.core.Component({
</ol>
<span *ngIf="workspace.topBlocks_.length === 0">
<i>Workspace is empty.</i>
<p>
There are no blocks in the workspace.
<button (click)="showToolboxModalForCreateNewGroup()">
Create new block group...
</button>
</p>
</span>
</div>
</div>
@@ -50,14 +55,21 @@ blocklyApp.WorkspaceComponent = ng.core.Component({
pipes: [blocklyApp.TranslatePipe]
})
.Class({
constructor: [blocklyApp.TreeService, function(_treeService) {
this.treeService = _treeService;
this.workspace = blocklyApp.workspace;
}],
constructor: [
blocklyApp.TreeService, blocklyApp.ToolboxModalService,
function(_treeService, _toolboxModalService) {
this.treeService = _treeService;
this.toolboxModalService = _toolboxModalService;
this.workspace = blocklyApp.workspace;
}
],
getActiveDescId: function(treeId) {
return this.treeService.getActiveDescId(treeId);
},
onKeypress: function(e, tree) {
this.treeService.onKeypress(e, tree);
},
showToolboxModalForCreateNewGroup: function() {
this.toolboxModalService.showToolboxModalForCreateNewGroup();
}
});