OSDN Git Service

Arranged Page Logic
authorhimatani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Sun, 30 Nov 2014 00:12:50 +0000 (09:12 +0900)
committerhimatani_cafe <fumifumi@yasunaga-lab.bio.kyutech.ac.jp>
Sun, 30 Nov 2014 00:12:50 +0000 (09:12 +0900)
zephyr/client/app/directive/navbar/navbar.html
zephyr/client/app/route/workspacePage/workspacePage.controller.js
zephyr/client/app/route/workspacePage/workspacePage.html

index dbec8e0..2435af9 100644 (file)
                     <a href="#"><i class="fa fa-dashboard fa-fw" ng-class="active"></i> Dashboard</a>
                 </li>
                 <li>
-                    <a href="commandPage"><i class="fa fa-bar-chart-o fa-fw"></i> Command</a>
+                    <a href="workspacePage/all"><i class="fa fa-table fa-fw"></i> WorkSpace</a>
                 </li>
                 <li>
-                    <a href="workspacePage/all"><i class="fa fa-table fa-fw"></i> WorkSpace</a>
+                    <a href="commandPage"><i class="fa fa-bar-chart-o fa-fw"></i> Command</a>
                 </li>
                 <li>
                     <a href="activityLogPage"><i class="fa fa-edit fa-fw"></i> Activity Log</a>
index f2adfc4..6dcf75c 100644 (file)
@@ -1,28 +1,57 @@
 'use strict';
 
 angular.module('zephyrApp')
-.controller('WorkspacepageCtrl', function ($scope, directivePath, createDirModal, api) {
+.controller('WorkspacepageCtrl', function ($scope, $location, directivePath, createDirModal, api) {
     //$scope.navbar = directivePath.navbar;
     $scope.tableRows = [];
 
-    $scope.openModal = function () {
+    if ($location.path() == "/workspacePage/all") {
+        $scope.path    = "All Workspace";
+        $scope.isAll   = true;
+        $scope.isChild = false;
+    } else {
+        $scope.path    = $location.path().replace("/workspacePage/","");
+        $scope.isAll   = false;
+        $scope.isChild = true;
+    }
+
+    $scope.openDirModal = function () {
         createDirModal.open($scope);
     };
 
+    $scope.openFileModal = function () {
+        createFileModal.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);
+        if ($scope.isAll) {
+            api('workspace/update');
+            var dirs = api('workspace/read');
+            dirs.$promise.then(function () {
+                angular.forEach(dirs, function (dir) {
+                    $scope.tableRows.push(dir);
+                });
             });
-        });
+        } else {
+            api('upload/update/'+$scope.path);
+            var files = api('upload/read/'+$scope.path);
+            files.$promise.then(function () {
+                console.log(files);
+                angular.forEach(files, function (file) {
+                    $scope.tableRows.push(file);
+                });
+            });
+        }
     }
 
     $scope.update();
 
+    $scope.move = function (path) {
+        $location.path('workspacePage/'+path); 
+    }
+
 });
 
 function Table(info) {
index fc3d21e..94637d2 100644 (file)
@@ -8,24 +8,29 @@
                 <div class="row page-header">
                     <ol class="breadcrumb">
                         <li>
-                            <i class="fa fa-dashboar"></i><a href="index.html">Dashboard</a>
+                            <a href="/">Dashboard</a>
                         </li>
-                        <li class="active">
-                            All Workspaces
+                        <li ng-class="{active: isAll}">
+                            <a ng-if="isChild" href="/workspacePage/all">All Workspace</a>
+                            <span ng-if="isAll">All Workspace</span>
+                        </li>
+                        <li ng-if="isChild" class="active">
+                            {{path}}
                         </li>
                     </ol>
                 </div>
 
                 <div class="row">
                     <div class="collapse navbar-collapse">
-                        <h3 class="pull-left" style="display:inline">All Workspaces</h3>
+                        <h3 class="pull-left" style="display:inline">{{path}}</h3>
                         <form class="navbar-form navbar-right" role="search">
                             <div class="form-group">
                                 <input type="text" class="form-control" placeholder="Search">
                             </div>
                         </form>
                         <ul class="nav navbar-nav navbar-right">
-                            <li popover-trigger="mouseenter" popover="Create"><a href="" ng-click="openModal()"><i class="icon-addfolderalt"></i></a></li>
+                            <li popover-trigger="mouseenter" popover="Create Workspace"><a href="" ng-click="openDirModal()"><i class="icon-addfolderalt"></i></a></li>
+                            <li ng-if="isChild" popover-trigger="mouseenter" popover="Upload File" ><a href="" ng-click="openFileModal()"><i class="icon-createfile"></i></a></li>
                         </ul>
                     </div>
                 </div>
@@ -40,8 +45,8 @@
                                 </tr>
                             </thead>
                             <tbody>
-                                <tr ng-repeat="row in tableRows">
-                                    <td>{{$index}}</td>
+                                <tr ng-repeat="row in tableRows" ng-click="move(row)">
+                                    <td>{{$index+1}}</td>
                                     <td>{{row}}</td>
                                 </tr>
                             </tbody>