Skip to content

Commit

Permalink
Added view site option to current tab listing
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Nov 10, 2016
1 parent 64abacf commit c9413a5
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 10 deletions.
7 changes: 5 additions & 2 deletions src/popup/app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
templateUrl: 'app/vault/views/vaultViewSite.html',
controller: 'vaultViewSiteController',
data: { authorize: true },
params: { animation: null, returnScrollY: 0, returnSearchText: null }
params: { animation: null, returnScrollY: 0, returnSearchText: null, fromCurrent: false }
})
.state('addSite', {
url: '/add-site',
Expand All @@ -110,7 +110,10 @@
templateUrl: 'app/vault/views/vaultEditSite.html',
controller: 'vaultEditSiteController',
data: { authorize: true },
params: { animation: null, fromView: true, returnScrollY: 0, returnSearchText: null, site: null }
params: {
animation: null, fromView: true, returnScrollY: 0,
returnSearchText: null, site: null, fromCurrent: false
}
})

.state('passwordGenerator', {
Expand Down
10 changes: 10 additions & 0 deletions src/popup/app/current/currentController.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ angular
}
};

$scope.viewSite = function (site, e) {
e.stopPropagation();

$state.go('viewSite', {
siteId: site.id,
animation: 'in-slide-up',
fromCurrent: true
});
};

$scope.$on('syncCompleted', function (event, successfully) {
if ($scope.loaded) {
setTimeout(loadVault, 500);
Expand Down
4 changes: 4 additions & 0 deletions src/popup/app/current/views/current.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
data-clipboard-text="{{site.username}}" ng-class="{'disabled': !site.username}">
<i class="fa fa-lg fa-user"></i>
</span>
<span class="btn-list" href="" ng-click="viewSite(site, $event) && $event.stopPropagation()"
title="{{i18n.edit}} {{site.name}}">
<i class="fa fa-lg fa-pencil"></i>
</span>
<span class="text">{{site.name}}</span>
<span class="detail">{{site.username}}</span>
</a>
Expand Down
4 changes: 3 additions & 1 deletion src/popup/app/vault/vaultEditSiteController.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ angular
var returnSearchText = $stateParams.returnSearchText;
var siteId = $stateParams.siteId;
var fromView = $stateParams.fromView;
var fromCurrent = $stateParams.fromCurrent;

$scope.site = {
folderId: null
Expand Down Expand Up @@ -73,7 +74,8 @@ angular
siteId: siteId,
animation: 'out-slide-down',
returnScrollY: returnScrollY || 0,
returnSearchText: returnSearchText
returnSearchText: returnSearchText,
fromCurrent: fromCurrent
});
}
else {
Expand Down
21 changes: 15 additions & 6 deletions src/popup/app/vault/vaultViewSiteController.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ angular
$scope.i18n = i18nService;
var returnScrollY = $stateParams.returnScrollY;
var returnSearchText = $stateParams.returnSearchText;
var fromCurrent = $stateParams.fromCurrent;

$scope.site = null;
siteService.get($stateParams.siteId, function (site) {
Expand Down Expand Up @@ -47,16 +48,24 @@ angular
siteId: site.id,
fromView: true,
returnScrollY: returnScrollY || 0,
returnSearchText: returnSearchText
returnSearchText: returnSearchText,
fromCurrent: fromCurrent
});
};

$scope.close = function () {
$state.go('tabs.vault', {
animation: 'out-slide-down',
scrollY: returnScrollY || 0,
searchText: returnSearchText
});
if (fromCurrent) {
$state.go('tabs.current', {
animation: 'out-slide-down'
});
}
else {
$state.go('tabs.vault', {
animation: 'out-slide-down',
scrollY: returnScrollY || 0,
searchText: returnSearchText
});
}
};

$scope.launchWebsite = function (site) {
Expand Down
2 changes: 1 addition & 1 deletion src/popup/app/vault/views/vaultViewSite.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<i class="fa fa-lg fa-clipboard"></i>
</a>
<span class="item-label">{{i18n.username}}</span>
<span id="username" class="monospaced">{{site.username}}</span>
<span id="username">{{site.username}}</span>
</div>
<div class="list-section-item" ng-if="site.password">
<a class="btn-list" href="" title="{{i18n.copyPassword}}" ngclipboard ngclipboard-error="clipboardError(e)"
Expand Down

0 comments on commit c9413a5

Please sign in to comment.