OSDN Git Service

manageable directory hierarchy added to multi sizes
authorhimetani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Mon, 3 Aug 2015 14:29:50 +0000 (23:29 +0900)
committerhimetani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Mon, 3 Aug 2015 14:29:50 +0000 (23:29 +0900)
client/index.html
server/api/dirInfo/index.js

index 4fd18df..7b0ece5 100644 (file)
         <script src="/client/app/components/commandModal/commandModal.controller.js"></script>
         <script src="/client/app/components/login/login.controller.js"></script>
         <script src="/client/app/components/login/login.js"></script>
+        <script src="/client/app/components/notes/notes.controller.js"></script>
+        <script src="/client/app/components/notes/notes.js"></script>
         <script src="/client/app/components/previewModal/previewModal.controller.js"></script>
         <script src="/client/app/components/saveFileModal/saveFileModal.controller.js"></script>
         <script src="/client/app/components/signup/signup.controller.js"></script>
         <script src="/client/app/components/signup/signup.js"></script>
         <script src="/client/app/components/workspace/workspace.controller.js"></script>
         <script src="/client/app/components/workspace/workspace.js"></script>
-        <script src="/client/app/components/notes/notes.controller.js"></script>
-        <script src="/client/app/components/notes/notes.js"></script>
         <!-- endinject -->
     </body>
 </html>
index a5a46dd..999959c 100644 (file)
@@ -11,20 +11,21 @@ router.post('', function(req, res) {
         email = req.body.email,
         dirPath, filesInfo
 
-    if(dir === 'root') {
+    if(dir === 'workspace') {
         dirPath = path.normalize(__dirname+'/../../../workspace/')
         jb.findOne('user', function(err, documents) {
             filesInfo = documents.workspaces.map(function(file) {
                 var filePath = dirPath + file
                 var stat = fs.statSync(filePath)
                 stat.name = file
+                stat.isDir = stat.isDirectory()
                 return stat
             })
             res.send(filesInfo)
         })
 
     } else {
-        dirPath = path.normalize(__dirname+'/../../../workspace/'+dir)
+        dirPath = path.normalize(__dirname+'/../../../workspace/'+dir.replace('workspace/',''))
         var files = fs.readdirSync(dirPath)
         var filesInfo = files.filter(function(file) {
             return file.substring(0,1) !== '.' && file !== 'preview' 
@@ -32,6 +33,7 @@ router.post('', function(req, res) {
         .map(function(file) {
             var stat = fs.statSync(dirPath+'/'+file)
             stat.name = file
+            stat.isDir = stat.isDirectory()
             return stat
         })
         res.send(filesInfo)