highlight active cipher and default folder for add

This commit is contained in:
Kyle Spearrin 2018-01-29 17:57:58 -05:00
parent 6d23338aa4
commit 7d2d4eafcb
5 changed files with 17 additions and 10 deletions

View File

@ -113,7 +113,7 @@ export class AddEditComponent implements OnChanges {
this.cipher = await cipher.decrypt();
} else {
this.cipher = new CipherView();
this.cipher.folderId = null; // TODO
this.cipher.folderId = this.folderId;
this.cipher.type = CipherType.Login;
this.cipher.login = new LoginView();
this.cipher.card = new CardView();

View File

@ -11,17 +11,17 @@
</div>
<div class="content">
<div class="list">
<a *ngFor="let cipher of ciphers" appStopClick (click)="cipherClicked(cipher)"
href="#" title="{{'viewItem' | i18n}}">
<app-vault-icon [cipher]="cipher"></app-vault-icon>
<a *ngFor="let c of ciphers" appStopClick (click)="cipherClicked(c)"
href="#" title="{{'viewItem' | i18n}}" [ngClass]="{'active': c.id === activeCipherId}">
<app-vault-icon [cipher]="c"></app-vault-icon>
<span class="text">
{{cipher.name}}
<i class="fa fa-share-alt text-muted" *ngIf="cipher.organizationId"
{{c.name}}
<i class="fa fa-share-alt text-muted" *ngIf="c.organizationId"
title="{{'shared' | i18n}}"></i>
<i class="fa fa-paperclip text-muted" *ngIf="cipher.attachments"
<i class="fa fa-paperclip text-muted" *ngIf="c.hasAttachments"
title="{{'attachments' | i18n}}"></i>
</span>
<span class="detail">{{cipher.subTitle}}</span>
<span class="detail">{{c.subTitle}}</span>
</a>
</div>
</div>

View File

@ -17,6 +17,7 @@ import { CipherService } from 'jslib/abstractions/cipher.service';
template: template,
})
export class CiphersComponent implements OnInit {
@Input() activeCipherId: string = null;
@Output() onCipherClicked = new EventEmitter<CipherView>();
@Output() onAddCipher = new EventEmitter();

View File

@ -7,6 +7,7 @@
(onCollectionClicked)="filterCollection($event.id)">
</app-vault-groupings>
<app-vault-ciphers id="items"
[activeCipherId]="cipherId"
(onCipherClicked)="viewCipher($event)"
(onAddCipher)="addCipher($event)">
</app-vault-ciphers>
@ -17,7 +18,7 @@
</app-vault-view>
<app-vault-add-edit id="details"
*ngIf="action === 'add' || action === 'edit'"
[folderId]="null"
[folderId]="action === 'add' && folderId !== 'none' ? folderId : null"
[cipherId]="action === 'edit' ? cipherId : null"
(onSavedCipher)="savedCipher($event)"
(onDeletedCipher)="deletedCipher($event)"

View File

@ -34,11 +34,16 @@
background-color: $list-item-hover;
}
&:not(:hover):focus {
&.active {
border-left: 5px solid $brand-primary;
padding-left: 5px;
}
&:focus:not(.active) {
border-left: 5px solid $text-muted;
padding-left: 5px;
}
.text, .detail {
white-space: nowrap;
overflow: hidden;