1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-06 09:20:43 +01:00

premium checks and layout updates for attachments

This commit is contained in:
Kyle Spearrin 2017-07-24 10:44:09 -04:00
parent 5de607b2a2
commit 80b18f8473
5 changed files with 10 additions and 7 deletions

View File

@ -2,10 +2,11 @@ angular
.module('bit.vault') .module('bit.vault')
.controller('vaultAttachmentsController', function ($scope, $state, $stateParams, loginService, $q, toastr, .controller('vaultAttachmentsController', function ($scope, $state, $stateParams, loginService, $q, toastr,
SweetAlert, utilsService, $analytics, i18nService, cryptoService) { SweetAlert, utilsService, $analytics, i18nService, cryptoService, tokenService) {
$scope.i18n = i18nService; $scope.i18n = i18nService;
utilsService.initListSectionItemListeners($(document), angular); utilsService.initListSectionItemListeners($(document), angular);
$scope.isPremium = tokenService.getPremium();
loginService.get($stateParams.id, function (login) { loginService.get($stateParams.id, function (login) {
$q.when(login.decrypt()).then(function (model) { $q.when(login.decrypt()).then(function (model) {
$scope.login = model; $scope.login = model;
@ -15,7 +16,7 @@ angular
$scope.canUseAttachments = false; $scope.canUseAttachments = false;
cryptoService.getEncKey().then(function (key) { cryptoService.getEncKey().then(function (key) {
$scope.canUseAttachments = !!key; $scope.canUseAttachments = !!key;
if (!$scope.canUseAttachments) { if (!$scope.canUseAttachments && $scope.isPremium) {
SweetAlert.swal({ SweetAlert.swal({
title: i18nService.featureUnavailable, title: i18nService.featureUnavailable,
text: i18nService.updateKey, text: i18nService.updateKey,

View File

@ -7,6 +7,7 @@ angular
var from = $stateParams.from, var from = $stateParams.from,
totpInterval = null; totpInterval = null;
$scope.isPremium = tokenService.getPremium();
$scope.login = null; $scope.login = null;
loginService.get($stateParams.loginId, function (login) { loginService.get($stateParams.loginId, function (login) {
if (!login) { if (!login) {

View File

@ -3,7 +3,7 @@
<div class="left"> <div class="left">
<a href="" ng-click="close()">{{i18n.close}}</a> <a href="" ng-click="close()">{{i18n.close}}</a>
</div> </div>
<div class="right"> <div class="right" ng-if="isPremium">
<button type="submit" class="btn btn-link" ng-show="!theForm.$loading">{{i18n.submit}}</button> <button type="submit" class="btn btn-link" ng-show="!theForm.$loading">{{i18n.submit}}</button>
<i class="fa fa-spinner fa-lg fa-spin no-animation" ng-show="theForm.$loading"></i> <i class="fa fa-spinner fa-lg fa-spin no-animation" ng-show="theForm.$loading"></i>
</div> </div>
@ -17,16 +17,16 @@
{{i18n.noAttachments}} {{i18n.noAttachments}}
</div> </div>
<div class="list-section-item" ng-repeat="attachment in login.attachments"> <div class="list-section-item" ng-repeat="attachment in login.attachments">
{{attachment.fileName}}
<span class="btn-list no-padding" stop-prop stop-click title="{{i18n.deleteAttachment}}" <span class="btn-list no-padding" stop-prop stop-click title="{{i18n.deleteAttachment}}"
ng-click="delete(attachment)"> ng-click="delete(attachment)">
<i class="fa fa-lg fa-trash"></i> <i class="fa fa-lg fa-trash"></i>
</span> </span>
<small class="item-sub-label">{{attachment.sizeName}}</small> <small class="item-sub-label">{{attachment.sizeName}}</small>
<span class="text">{{attachment.fileName}}</span>
</div> </div>
</div> </div>
</div> </div>
<div class="list-section"> <div class="list-section" ng-if="isPremium">
<div class="list-section-header"> <div class="list-section-header">
{{i18n.newAttachment}} {{i18n.newAttachment}}
</div> </div>

View File

@ -76,7 +76,7 @@
<div class="list-section-item pre">{{login.notes}}</div> <div class="list-section-item pre">{{login.notes}}</div>
</div> </div>
</div> </div>
<div class="list-section" ng-if="login.attachments && login.attachments.length"> <div class="list-section" ng-if="isPremium && login.attachments && login.attachments.length">
<div class="list-section-header"> <div class="list-section-header">
{{i18n.attachments}} {{i18n.attachments}}
</div> </div>
@ -84,10 +84,10 @@
<a class="list-section-item list-allow-selection" href="#" stop-click <a class="list-section-item list-allow-selection" href="#" stop-click
ng-repeat="attachment in login.attachments" ng-repeat="attachment in login.attachments"
ng-click="download(attachment)"> ng-click="download(attachment)">
{{attachment.fileName}}
<i class="fa fa-download right-icon fa-fw no-animation" ng-if="!attachment.downloading"></i> <i class="fa fa-download right-icon fa-fw no-animation" ng-if="!attachment.downloading"></i>
<i class="fa fa-spin fa-spinner right-icon fa-fw no-animation" ng-if="attachment.downloading"></i> <i class="fa fa-spin fa-spinner right-icon fa-fw no-animation" ng-if="attachment.downloading"></i>
<small class="item-sub-label">{{attachment.sizeName}}</small> <small class="item-sub-label">{{attachment.sizeName}}</small>
<span class="text">{{attachment.fileName}}</span>
</a> </a>
</div> </div>
</div> </div>

View File

@ -350,6 +350,7 @@
.item-sub-label { .item-sub-label {
float: right; float: right;
display: block;
margin-right: 15px; margin-right: 15px;
color: @gray-light; color: @gray-light;
} }