mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-17 20:31:50 +01:00
vault edit site
This commit is contained in:
parent
eed9956ff5
commit
9ebec2a1bc
@ -88,7 +88,7 @@
|
||||
templateUrl: "app/vault/views/vaultEditSite.html",
|
||||
controller: 'vaultEditSiteController',
|
||||
data: { authorize: true },
|
||||
params: { animation: null }
|
||||
params: { animation: null, fromView: true }
|
||||
});
|
||||
})
|
||||
.run(function ($rootScope, userService, loginService, tokenService, $state) {
|
||||
|
@ -1,16 +1,47 @@
|
||||
angular
|
||||
.module('bit.vault')
|
||||
|
||||
.controller('vaultEditSiteController', function ($scope, siteService, cryptoService) {
|
||||
.controller('vaultEditSiteController', function ($scope, $state, $stateParams, siteService, cipherService, $q) {
|
||||
$scope.site = {
|
||||
folderId: null
|
||||
};
|
||||
|
||||
$scope.editSite = function (model) {
|
||||
siteService.get($stateParams.siteId, function (site) {
|
||||
cipherService.decryptSite(site).then(function (model) {
|
||||
$scope.site = model;
|
||||
});
|
||||
});
|
||||
|
||||
popupUtils.initListSectionItemListeners();
|
||||
|
||||
$scope.savePromise = null;
|
||||
$scope.save = function (model) {
|
||||
$scope.savePromise = cipherService.encryptSite(model).then(function (siteModel) {
|
||||
var site = new Site(siteModel, true);
|
||||
return site;
|
||||
}).then(function (site) {
|
||||
return saveSite(site, function (site) {
|
||||
alert('Saved ' + site.id + '!');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$scope.parentScope.closeEditSite();
|
||||
if ($stateParams.fromView) {
|
||||
$state.go('viewSite', { siteId: $stateParams.siteId, animation: 'out-slide-down' });
|
||||
}
|
||||
else {
|
||||
$state.go('tabs.vault', { animation: 'out-slide-down' });
|
||||
}
|
||||
};
|
||||
|
||||
function saveSite(site) {
|
||||
return $q(function (resolve, reject) {
|
||||
siteService.saveWithServer(site, function (site) {
|
||||
resolve(site);
|
||||
}, function (error) {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
<form name="theForm" ng-submit="theForm.$valid && save(site)" bit-form="savePromise">
|
||||
<div class="header">
|
||||
<div class="left">
|
||||
<a ng-click="close()" href="">Close</a>
|
||||
<a ng-click="close()" href="">Cancel</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<button type="submit" class="btn btn-link" ng-show="!theForm.$loading">Save</button>
|
||||
|
@ -1,63 +1,69 @@
|
||||
<ion-modal-view ng-controller="vaultEditSiteController">
|
||||
<ion-header-bar class="bar bar-header bar-positive">
|
||||
<button class="button button-clear button-primary" ng-click="close()">Cancel</button>
|
||||
<h1 class="title">Edit Site</h1>
|
||||
<button class="button button-clear button-primary" ng-click="editSite(site)">Save</button>
|
||||
</ion-header-bar>
|
||||
<ion-content>
|
||||
<form name="theForm" ng-submit="theForm.$valid && save(site)" bit-form="savePromise">
|
||||
<div class="header">
|
||||
<div class="left">
|
||||
<a ng-click="close()" href="">Cancel</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<button type="submit" class="btn btn-link" ng-show="!theForm.$loading">Save</button>
|
||||
<i class="fa fa-spinner fa-lg" ng-show="theForm.$loading" ng-class="{'fa-spin' : theForm.$loading}"></i>
|
||||
</div>
|
||||
<div class="title">Edit Site</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="list">
|
||||
<div class="item item-divider">
|
||||
Site Information
|
||||
</div>
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label">Name</span>
|
||||
<input type="text" ng-model="site.name">
|
||||
</label>
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label">URI</span>
|
||||
<input type="text" ng-model="site.uri">
|
||||
</label>
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label">Username</span>
|
||||
<input type="text" ng-model="site.username">
|
||||
</label>
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label">Password</span>
|
||||
<input type="password" ng-model="site.password">
|
||||
</label>
|
||||
<a class="item item-icon-right" href="#">
|
||||
Generate Password
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</a>
|
||||
<div class="item item-divider">
|
||||
|
||||
</div>
|
||||
<label class="item item-input item-select">
|
||||
<div class="input-label">Folder</div>
|
||||
<select>
|
||||
<option>Blue</option>
|
||||
<option selected>Green</option>
|
||||
<option>Red</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="item item-toggle">
|
||||
Favorite
|
||||
<label class="toggle toggle-assertive">
|
||||
<input type="checkbox" ng-model="site.favorite">
|
||||
<div class="track">
|
||||
<div class="handle"></div>
|
||||
<div class="list-section">
|
||||
<div class="list-section-header">
|
||||
Site Information
|
||||
</div>
|
||||
<div class="list-section-items">
|
||||
<div class="list-section-item">
|
||||
<label for="name">Name</label>
|
||||
<input id="name" type="text" name="Name" ng-model="site.name" bit-field>
|
||||
</div>
|
||||
</label>
|
||||
<div class="list-section-item">
|
||||
<label for="uri">URI</label>
|
||||
<input id="uri" type="text" name="Uri" ng-model="site.uri" bit-field>
|
||||
</div>
|
||||
<div class="list-section-item">
|
||||
<label for="username">Username</label>
|
||||
<input id="username" type="text" name="Username" ng-model="site.username" bit-field>
|
||||
</div>
|
||||
<div class="list-section-item">
|
||||
<label for="password">Password</label>
|
||||
<input id="password" type="password" name="Password" ng-model="site.password" bit-field>
|
||||
</div>
|
||||
<a class="list-section-item" href="#">
|
||||
Generate Password
|
||||
<i class="fa fa-chevron-right pull-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item item-divider">
|
||||
Notes
|
||||
<div class="list-section">
|
||||
<div class="list-section-items">
|
||||
<div class="list-section-item">
|
||||
<label for="folder">Folder</label>
|
||||
<select id="folder" name="FolderId">
|
||||
<option>Blue</option>
|
||||
<option selected>Green</option>
|
||||
<option>Red</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="list-section-item list-section-item-checkbox">
|
||||
<label for="favorite">Favorite</label>
|
||||
<input id="favorite" name="Favorite" type="checkbox" ng-model="site.favorite" bit-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item item-input">
|
||||
<textarea rows="5" ng-model="site.notes"></textarea>
|
||||
</div>
|
||||
<div class="item item-divider">
|
||||
|
||||
<div class="list-section">
|
||||
<div class="list-section-header">
|
||||
<label for="notes">Notes</label>
|
||||
</div>
|
||||
<div class="list-section-items">
|
||||
<div class="list-section-item">
|
||||
<textarea id="notes" name="Notes" rows="5" ng-model="site.notes" bit-field></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-modal-view>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<div class="header">
|
||||
<div class="left">
|
||||
<a ui-sref="tabs.vault({animation: 'out-slide-down'})">Close</a>
|
||||
<a href="" ui-sref="tabs.vault({animation: 'out-slide-down'})">Close</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a href="#">Edit</a>
|
||||
<a href="" ui-sref="editSite({animation: 'in-slide-up', siteId: site.id, fromView: true})">Edit</a>
|
||||
</div>
|
||||
<div class="title">View Site</div>
|
||||
</div>
|
||||
|
@ -49,3 +49,55 @@
|
||||
top: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.in-slide-left {
|
||||
.main-view.ng-enter,
|
||||
.main-view.ng-leave {
|
||||
-webkit-transition: all 0.4s ease;
|
||||
transition: all 0.4s ease;
|
||||
}
|
||||
|
||||
.main-view.ng-enter {
|
||||
left: 100%;
|
||||
z-index: 970;
|
||||
}
|
||||
|
||||
.main-view.ng-enter.ng-enter-active {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.main-view.ng-leave {
|
||||
left: 0;
|
||||
z-index: 990;
|
||||
}
|
||||
|
||||
.main-view.ng-leave.ng-leave-active {
|
||||
left: -100%;
|
||||
}
|
||||
}
|
||||
|
||||
.out-slide-right {
|
||||
.main-view.ng-enter,
|
||||
.main-view.ng-leave {
|
||||
-webkit-transition: all 0.4s ease;
|
||||
transition: all 0.4s ease;
|
||||
}
|
||||
|
||||
.main-view.ng-enter {
|
||||
right: 100%;
|
||||
z-index: 970;
|
||||
}
|
||||
|
||||
.main-view.ng-enter.ng-enter-active {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.main-view.ng-leave {
|
||||
right: 0;
|
||||
z-index: 990;
|
||||
}
|
||||
|
||||
.main-view.ng-leave.ng-leave-active {
|
||||
right: -100%;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user