From 81c0a8373fd5cb051531762243e200f11f8c7297 Mon Sep 17 00:00:00 2001
From: Sam Wilkins <abdullah_ahmed@brown.edu>
Date: Sat, 9 Mar 2019 23:00:41 -0500
Subject: editable workspace titles now supported, added 'display' prop to
 EditableView

---
 .../authentication/controllers/WorkspacesMenu.tsx  | 32 +++++++++++++++-------
 1 file changed, 22 insertions(+), 10 deletions(-)

(limited to 'src/server/authentication/controllers/WorkspacesMenu.tsx')

diff --git a/src/server/authentication/controllers/WorkspacesMenu.tsx b/src/server/authentication/controllers/WorkspacesMenu.tsx
index 70c37774c..ffef2e11c 100644
--- a/src/server/authentication/controllers/WorkspacesMenu.tsx
+++ b/src/server/authentication/controllers/WorkspacesMenu.tsx
@@ -7,6 +7,8 @@ import './WorkspacesMenu.css'
 import { Document } from '../../../fields/Document';
 import { Server } from '../../../client/Server';
 import { Field } from '../../../fields/Field';
+import { EditableView } from '../../../client/views/EditableView';
+import { KeyStore } from '../../../fields/KeyStore';
 
 export interface WorkspaceMenuProps {
     active: Document;
@@ -67,19 +69,29 @@ export class WorkspacesMenu extends React.Component<WorkspaceMenuProps> {
                     }}
                     onClick={this.addNewWorkspace}
                 />
-                {this.props.allWorkspaces.map(s =>
-                    <li className={"ids"}
+                {this.props.allWorkspaces.map((s, i) =>
+                    <div
                         key={s.Id}
-                        style={{
-                            listStyleType: "none",
-                            color: s.Id === this.props.active.Id ? "darkblue" : "black",
-                            cursor: "grab"
-                        }}
-                        onClick={() => {
+                        onContextMenu={(e) => {
+                            e.preventDefault();
                             this.props.open(s);
-                            console.log(this.props.allWorkspaces.length);
                         }}
-                    >{s.Title}</li>
+                        style={{
+                            marginTop: 10
+                        }}
+                    >
+                        <span>{i + 1} - </span>
+                        <EditableView
+                            display={"inline"}
+                            GetValue={() => { return s.Title }}
+                            SetValue={(title: string): boolean => {
+                                s.SetText(KeyStore.Title, title);
+                                return true;
+                            }}
+                            contents={s.Title}
+                            height={20}
+                        />
+                    </div>
                 )}
             </div>
         );
-- 
cgit v1.2.3-70-g09d2

