OSDN Git Service

Create Dir on Front End
authorhimatani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Sat, 29 Nov 2014 22:28:34 +0000 (07:28 +0900)
committerhimatani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Sat, 29 Nov 2014 22:28:34 +0000 (07:28 +0900)
zephyr/client/app/directive/navbar/navbar.html
zephyr/client/app/route/activityLogPage/activityLogPage.html
zephyr/client/app/route/workspacePage/workspacePage.controller.js
zephyr/client/app/route/workspacePage/workspacePage.html
zephyr/client/app/route/workspacePage/workspacePage.js
zephyr/client/app/service/createDirModal/createDirModal.controller.js [new file with mode: 0644]
zephyr/client/app/service/createDirModal/createDirModal.html [new file with mode: 0644]
zephyr/client/app/service/createDirModal/createDirModal.service.js
zephyr/client/index.html
zephyr/server/api/workspace/workspace.controller.js

index e1cd128..dbec8e0 100644 (file)
                     <a href="commandPage"><i class="fa fa-bar-chart-o fa-fw"></i> Command</a>
                 </li>
                 <li>
-                    <a href="workspacePage"><i class="fa fa-table fa-fw"></i> WorkSpace</a>
+                    <a href="workspacePage/all"><i class="fa fa-table fa-fw"></i> WorkSpace</a>
                 </li>
                 <li>
                     <a href="activityLogPage"><i class="fa fa-edit fa-fw"></i> Activity Log</a>
index d77a58f..177681a 100644 (file)
@@ -4,7 +4,7 @@
     <div class="page-header">
         <div class="row">
             <div class="col-lg-12">
-                <h1>WorkSpace</h1>
+                <h1>Activity Log</h1>
             </div>
             <!-- /.col-lg-12 -->
         </div>
index 6997513..f2adfc4 100644 (file)
@@ -1,15 +1,28 @@
 'use strict';
 
 angular.module('zephyrApp')
-.controller('WorkspacepageCtrl', function ($scope, directivePath, modalService) {
+.controller('WorkspacepageCtrl', function ($scope, directivePath, createDirModal, api) {
     //$scope.navbar = directivePath.navbar;
     $scope.tableRows = [];
-    $scope.tableRows.push(new Table("hoge"));
-    $scope.tableRows.push(new Table("hoge"));
-    $scope.tableRows.push(new Table("hoge"));
-    $scope.tableRows.push(new Table("hoge"));
-    $scope.tableRows.push(new Table("hoge"));
-    $scope.tableRows.push(new Table("hoge"));
+
+    $scope.openModal = function () {
+        createDirModal.open($scope);
+    };
+
+
+    $scope.update = function () {
+        $scope.tableRows = [];
+        api('workspace/update');
+        var dirs = api('workspace/read');
+        dirs.$promise.then(function () {
+            angular.forEach(dirs, function (dir) {
+                $scope.tableRows.push(dir);
+            });
+        });
+    }
+
+    $scope.update();
+
 });
 
 function Table(info) {
@@ -18,5 +31,7 @@ function Table(info) {
         size: info,
         created_time: info
     };
-   return row;
+    return row;
 };
+
+
index 37c3690..fc3d21e 100644 (file)
@@ -3,7 +3,7 @@
     <div id="page-wrapper">
         <div ng-controller="WorkspacepageCtrl">
 
-            <div class="container">
+            <div class="container-fluid">
 
                 <div class="row page-header">
                     <ol class="breadcrumb">
@@ -25,7 +25,7 @@
                             </div>
                         </form>
                         <ul class="nav navbar-nav navbar-right">
-                            <li popover-trigger="mouseenter" popover="Create"><a href=""><i class="icon-addfolderalt"></i></a></li>
+                            <li popover-trigger="mouseenter" popover="Create"><a href="" ng-click="openModal()"><i class="icon-addfolderalt"></i></a></li>
                         </ul>
                     </div>
                 </div>
                                 <tr>
                                     <th>#</th>
                                     <th>Name</th>
-                                    <th>Size</th>
-                                    <th>Created Time</th>
                                 </tr>
                             </thead>
                             <tbody>
                                 <tr ng-repeat="row in tableRows">
                                     <td>{{$index}}</td>
-                                    <td>{{row.name}}</td>
-                                    <td>{{row.size}}</td>
-                                    <td>{{row.created_time}}</td>
+                                    <td>{{row}}</td>
                                 </tr>
                             </tbody>
                         </table>
index 06272ff..7b839c6 100644 (file)
@@ -3,7 +3,7 @@
 angular.module('zephyrApp')
   .config(function ($routeProvider) {
     $routeProvider
-      .when('/workspacePage', {
+      .when('/workspacePage/:id', {
         templateUrl: 'app/route/workspacePage/workspacePage.html',
         controller: 'WorkspacepageCtrl'
       });
diff --git a/zephyr/client/app/service/createDirModal/createDirModal.controller.js b/zephyr/client/app/service/createDirModal/createDirModal.controller.js
new file mode 100644 (file)
index 0000000..d5cbf68
--- /dev/null
@@ -0,0 +1,18 @@
+angular.module('zephyrApp')
+.controller('CreateDirModalCtrl', function ($scope, $modalInstance, api) {
+
+    $scope.create = function () {
+        $modalInstance.close();
+    };
+
+    $scope.cancel      = function() {
+        $modalInstance.close();
+    };
+
+    $scope.create = function (dirName) {
+        api('workspace/create/'+dirName);
+        $scope.update();
+        $modalInstance.close();
+    };
+
+});
diff --git a/zephyr/client/app/service/createDirModal/createDirModal.html b/zephyr/client/app/service/createDirModal/createDirModal.html
new file mode 100644 (file)
index 0000000..a2d887c
--- /dev/null
@@ -0,0 +1,11 @@
+<div class="modal-header">
+    <h3>Create New Workspace</h3>
+</div>
+<div class="modal-body">
+    <label for="new">Name</label>
+    <input id="new" type="text" ng-required="true" ng-model="dirName" value="money">
+</div>
+<div class="modal-footer">
+    <button class="btn" ng-click="create(dirName)" type="button">Create</button>
+    <button class="btn btn-warning cancel" ng-click="cancel()" type="button">Cancel</button>
+</div>
index 4c2134d..204e50d 100644 (file)
@@ -1,6 +1,17 @@
 'use strict';
 
 angular.module('zephyrApp')
-  .service('createDirModal', function () {
-    // AngularJS will instantiate a singleton by calling "new" on this function
-  });
+.service('createDirModal', function ($modal) {
+    var openModal = function (scope) {
+        $modal.open({
+            templateUrl: 'app/service/createDirModal/createDirModal.html',
+            controller : 'CreateDirModalCtrl',
+            badkdrop: true,
+            scope: scope
+        });
+    };
+
+    return {
+        open: openModal
+    }
+});
index 8a5f5cf..20ef7e3 100644 (file)
@@ -85,8 +85,8 @@
           <script src="app/route/executionPage/executionPage.js"></script>
           <script src="app/route/workspacePage/workspacePage.controller.js"></script>
           <script src="app/route/workspacePage/workspacePage.js"></script>
-          <script src="app/service/modalService/modalService.controller.js"></script>
-          <script src="app/service/modalService/modalService.service.js"></script>
+          <script src="app/service/createDirModal/createDirModal.controller.js"></script>
+          <script src="app/service/createDirModal/createDirModal.service.js"></script>
           <!-- endinjector -->
         <!-- endbuild -->
 </body>
index 43095bc..6d212e5 100644 (file)
@@ -22,6 +22,7 @@ exports.create = function (req, res) {
 
 exports.read = function (req, res) {
     var workspace = new WorkspaceConstructor();
+    console.log(JSON.stringify(workspace.read()));
     res.send(workspace.read());
 };