Browse Source

Fix landing page.

Afshin Darian 8 years ago
parent
commit
c0fab9d6cb
1 changed files with 18 additions and 10 deletions
  1. 18 10
      packages/landing-extension/src/widget.ts

+ 18 - 10
packages/landing-extension/src/widget.ts

@@ -1,6 +1,10 @@
 // Copyright (c) Jupyter Development Team.
 // Copyright (c) Jupyter Development Team.
 // Distributed under the terms of the Modified BSD License.
 // Distributed under the terms of the Modified BSD License.
 
 
+import {
+  JSONObject
+} from '@phosphor/coreutils';
+
 import {
 import {
   Message
   Message
 } from '@phosphor/messaging';
 } from '@phosphor/messaging';
@@ -99,7 +103,7 @@ class LandingModel extends VDomModel {
   /**
   /**
    * The names of activities and their associated commands.
    * The names of activities and their associated commands.
    */
    */
-  readonly activities: string[][];
+  readonly activities: [string, string, JSONObject][];
 
 
   /**
   /**
    * Construct a new landing model.
    * Construct a new landing model.
@@ -110,14 +114,16 @@ class LandingModel extends VDomModel {
       Math.floor(Math.random() * previewMessages.length)
       Math.floor(Math.random() * previewMessages.length)
     ];
     ];
     this.headerText = 'Start a new activity';
     this.headerText = 'Start a new activity';
+
+    const createFrom = 'file-operations:create-from';
     this.activities = [
     this.activities = [
-      ['Notebook', 'filebrowser:new-notebook'],
-      ['Code Console', 'console:create'],
-      ['Text Editor', 'filebrowser:new-text-file']
+      ['Notebook', createFrom, { creatorName: 'Notebook' }],
+      ['Code Console', 'console:create', undefined],
+      ['Text Editor', createFrom, { creatorName: 'Text File' }]
     ];
     ];
 
 
     if (terminalsAvailable) {
     if (terminalsAvailable) {
-      this.activities.push(['Terminal', 'terminal:create-new']);
+      this.activities.push(['Terminal', 'terminal:create-new', undefined]);
     }
     }
   }
   }
 }
 }
@@ -158,14 +164,16 @@ class LandingWidget extends VDomWidget<LandingModel> {
     let activitiesList: VirtualNode[] = [];
     let activitiesList: VirtualNode[] = [];
     let activites = this.model.activities;
     let activites = this.model.activities;
     for (let activityName of activites) {
     for (let activityName of activites) {
-      let imgName = activityName[0].replace(' ', '');
-      let column =
-      h.div({ className: LANDING_COLUMN_CLASS },
+      let name = activityName[0];
+      let command = activityName[1];
+      let args = activityName[2];
+      let imgName = name.replace(' ', '');
+      let column = h.div({ className: LANDING_COLUMN_CLASS },
         h.span({
         h.span({
           className: LANDING_ICON_CLASS + ` jp-Image${imgName}` ,
           className: LANDING_ICON_CLASS + ` jp-Image${imgName}` ,
-          dataset: this._linker.populateVNodeDataset(activityName[1], {})
+          dataset: this._linker.populateVNodeDataset(command, args)
         }),
         }),
-        h.span({ className: LANDING_TEXT_CLASS }, activityName[0])
+        h.span({ className: LANDING_TEXT_CLASS }, name)
       );
       );
       activitiesList.push(column);
       activitiesList.push(column);
     }
     }