From 05a92ebd260a5a168c98a815b93f35c72ad044a5 Mon Sep 17 00:00:00 2001
From: Kyle Spearrin <kyle.spearrin@gmail.com>
Date: Tue, 28 Feb 2017 23:43:54 -0500
Subject: [PATCH] remove share login modal and add organizations box

---
 src/app/settings/views/settings.html       | 25 ++++++++++
 src/app/vault/vaultController.js           | 16 ------
 src/app/vault/vaultShareLoginController.js | 33 -------------
 src/app/vault/views/vault.html             |  6 +--
 src/app/vault/views/vaultShareLogin.html   | 57 ----------------------
 src/app/views/backendLayout.html           |  2 +-
 6 files changed, 27 insertions(+), 112 deletions(-)
 delete mode 100644 src/app/vault/vaultShareLoginController.js
 delete mode 100644 src/app/vault/views/vaultShareLogin.html

diff --git a/src/app/settings/views/settings.html b/src/app/settings/views/settings.html
index b1a7fdad97..18deb51e9d 100644
--- a/src/app/settings/views/settings.html
+++ b/src/app/settings/views/settings.html
@@ -109,6 +109,31 @@
             </button>
         </div>
     </div>
+    <div class="box box-default">
+        <div class="box-header with-border">
+            <h3 class="box-title">Organizations</h3>
+        </div>
+        <div class="box-body no-padding">
+            <div class="table-responsive">
+                <table class="table table-striped table-hover">
+                    <thead>
+                        <tr>
+                            <th style="width: 75px; min-width: 75px;"></th>
+                            <th>Name</th>
+                            <th style="width: 200px;">Plan</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        <tr>
+                            <td></td>
+                            <td>sdfsdf</td>
+                            <td>dfd</td>
+                        </tr>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
     <div class="box box-danger">
         <div class="box-header with-border">
             <h3 class="box-title">Danger Zone</h3>
diff --git a/src/app/vault/vaultController.js b/src/app/vault/vaultController.js
index 4d76a062ba..39cd8cce26 100644
--- a/src/app/vault/vaultController.js
+++ b/src/app/vault/vaultController.js
@@ -163,20 +163,4 @@
             var logins = $filter('filter')($scope.logins, { folderId: folder.id });
             return logins.length === 0;
         };
-
-        $scope.shareLogin = function (login) {
-            var shareModel = $uibModal.open({
-                animation: true,
-                templateUrl: 'app/vault/views/vaultShareLogin.html',
-                controller: 'vaultShareLoginController',
-                size: 'lg',
-                resolve: {
-                    id: function () { return login.id; }
-                }
-            });
-
-            shareModel.result.then(function (result) {
-
-            });
-        };
     });
diff --git a/src/app/vault/vaultShareLoginController.js b/src/app/vault/vaultShareLoginController.js
deleted file mode 100644
index d72d4ba97a..0000000000
--- a/src/app/vault/vaultShareLoginController.js
+++ /dev/null
@@ -1,33 +0,0 @@
-angular
-    .module('bit.vault')
-
-    .controller('vaultShareLoginController', function ($scope, apiService, $uibModalInstance, cryptoService, cipherService,
-        id, $analytics) {
-        $analytics.eventTrack('vaultShareLoginController', { category: 'Modal' });
-
-        apiService.logins.get({
-            id: id
-        }, function (login) {
-            $scope.login = cipherService.decryptLogin(login);
-        });
-
-        $scope.enablePromise = null;
-        $scope.enable = function () {
-            var shareKey = cryptoService.makeShareKey();
-            var encLogin = cipherService.encryptLogin($scope.login, shareKey);
-            encLogin.key = cryptoService.rsaEncrypt(shareKey);
-
-            $scope.enablePromise = apiService.logins.put({ id: $scope.login.id }, encLogin, function (login) {
-                $scope.login = cipherService.decryptLogin(login);
-            }).$promise;
-        };
-
-        $scope.sharePromise = null;
-        $scope.share = function () {
-            $uibModalInstance.close({});
-        };
-
-        $scope.close = function () {
-            $uibModalInstance.dismiss('cancel');
-        };
-    });
diff --git a/src/app/vault/views/vault.html b/src/app/vault/views/vault.html
index 89f455efc7..e7d7f5ccb2 100644
--- a/src/app/vault/views/vault.html
+++ b/src/app/vault/views/vault.html
@@ -47,7 +47,7 @@
                 <table class="table table-striped table-hover table-selectable">
                     <thead>
                         <tr>
-                            <th style="width: 115px; min-width: 115px;"></th>
+                            <th style="width: 75px; min-width: 75px;"></th>
                             <th>Name</th>
                             <th style="width: 300px;">Username</th>
                         </tr>
@@ -64,10 +64,6 @@
                                         uib-tooltip="View/Edit">
                                     <i class="fa fa-lg fa-pencil"></i>
                                 </button>
-                                <button type="button" ng-click="shareLogin(login)" class="btn btn-link btn-table"
-                                        uib-tooltip="Share">
-                                    <i class="fa fa-lg fa-user-plus"></i>
-                                </button>
                             </td>
                             <td ng-click="editLogin(login)">
                                 <span ng-click="$event.stopPropagation()">
diff --git a/src/app/vault/views/vaultShareLogin.html b/src/app/vault/views/vaultShareLogin.html
deleted file mode 100644
index 4d2aebd73f..0000000000
--- a/src/app/vault/views/vaultShareLogin.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<div class="modal-header">
-    <button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
-    <h4 class="modal-title" id="editFolderModelLabel">
-        <i class="fa fa-user-plus"></i> Share Login <small>{{login.name}}</small>
-    </h4>
-</div>
-<form name="enableForm" ng-submit="enableForm.$valid && enable()" api-form="savePromise" ng-if="!login.key">
-    <div class="modal-body">
-        <div class="callout callout-danger validation-errors" ng-show="enableForm.$errors">
-            <h4>Errors have occured</h4>
-            <ul>
-                <li ng-repeat="e in enableForm.$errors">{{e}}</li>
-            </ul>
-        </div>
-        Sharing is not enabled.
-    </div>
-    <div class="modal-footer">
-        <button type="submit" class="btn btn-primary btn-flat" ng-disabled="enableForm.$loading">
-            <i class="fa fa-refresh fa-spin loading-icon" ng-show="enableForm.$loading"></i>Enable Sharing
-        </button>
-        <button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
-    </div>
-</form>
-<form name="shareForm" ng-submit="shareForm.$valid && share()" api-form="savePromise" ng-if="login.key">
-    <div class="modal-body">
-        <div class="callout callout-danger validation-errors" ng-show="shareForm.$errors">
-            <h4>Errors have occured</h4>
-            <ul>
-                <li ng-repeat="e in shareForm.$errors">{{e}}</li>
-            </ul>
-        </div>
-        <div class="row">
-            <div class="col-md-6">
-                <div class="form-group" show-errors>
-                    <label for="email">Recipient Email address</label> <span>*</span>
-                    <input type="email" id="email" name="Email" ng-model="share.email" class="form-control"
-                           placeholder="bob@example.com" required api-field />
-                </div>
-                <div class="checkbox">
-                    <label>
-                        <input type="checkbox" ng-model="share.readonly" name="Edit" />
-                        Recipient can edit?
-                    </label>
-                </div>
-            </div>
-            <div class="col-md-6">
-
-            </div>
-        </div>
-    </div>
-    <div class="modal-footer">
-        <button type="submit" class="btn btn-primary btn-flat" ng-disabled="shareForm.$loading">
-            <i class="fa fa-refresh fa-spin loading-icon" ng-show="shareForm.$loading"></i>Share
-        </button>
-        <button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
-    </div>
-</form>
\ No newline at end of file
diff --git a/src/app/views/backendLayout.html b/src/app/views/backendLayout.html
index 1feaccd06d..8b48a76a51 100644
--- a/src/app/views/backendLayout.html
+++ b/src/app/views/backendLayout.html
@@ -60,7 +60,7 @@
                     ng-class="{active: $state.is('backend.shared') || $state.is('backend.sharedMe')}">
                     <a ui-sref="backend.shared">
                         <small class="label pull-right bg-yellow">beta</small>
-                        <i class="fa fa-users fa-fw"></i> <span>Sharing Center</span>
+                        <i class="fa fa-share-alt fa-fw"></i> <span>Sharing Center</span>
                     </a>
                     <ul class="treeview-menu" ng-class="{'menu-open': $state.is('backend.shared')
                         || $state.is('backend.sharedMe')}">