diff --git a/src/app/vault/vaultController.js b/src/app/vault/vaultController.js index 6e479dd93c..7d29a28d45 100644 --- a/src/app/vault/vaultController.js +++ b/src/app/vault/vaultController.js @@ -338,7 +338,26 @@ return; } - // TODO + var modal = $uibModal.open({ + animation: true, + templateUrl: 'app/vault/views/vaultMoveLogins.html', + controller: 'vaultMoveLoginsController', + resolve: { + ids: function () { return ids; } + } + }); + + modal.result.then(function (folderId) { + for (var i = 0; i < ids.length; i++) { + var login = $filter('filter')($rootScope.vaultLogins, { id: ids[i] }); + if (login.length) { + login[0].folderId = folderId; + } + } + + clearLoginSelections(); + sortScopedLoginData(); + }); }; $scope.bulkDelete = function () { diff --git a/src/app/vault/vaultMoveLoginsController.js b/src/app/vault/vaultMoveLoginsController.js new file mode 100644 index 0000000000..b5e5c8484c --- /dev/null +++ b/src/app/vault/vaultMoveLoginsController.js @@ -0,0 +1,28 @@ +angular + .module('bit.vault') + + .controller('vaultMoveLoginsController', function ($scope, apiService, $uibModalInstance, ids, $analytics, + $rootScope) { + $analytics.eventTrack('vaultMoveLoginsController', { category: 'Modal' }); + $scope.folders = $rootScope.vaultFolders; + $scope.count = ids.length; + + $scope.save = function () { + $scope.savePromise = apiService.ciphers.moveMany({ ids: ids, folderId: $scope.folderId }, function () { + $analytics.eventTrack('Bulk Moved Logins'); + $uibModalInstance.close($scope.folderId || null); + }).$promise; + }; + + $scope.folderSort = function (item) { + if (!item.id) { + return '!'; + } + + return item.name.toLowerCase(); + }; + + $scope.close = function () { + $uibModalInstance.dismiss('cancel'); + }; + }); diff --git a/src/app/vault/views/vaultMoveLogins.html b/src/app/vault/views/vaultMoveLogins.html new file mode 100644 index 0000000000..c6ae5cfab1 --- /dev/null +++ b/src/app/vault/views/vaultMoveLogins.html @@ -0,0 +1,34 @@ + +
+ + +
diff --git a/src/index.html b/src/index.html index 52085a2552..29f1e2be16 100644 --- a/src/index.html +++ b/src/index.html @@ -159,6 +159,7 @@ +