mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-02 18:17:46 +01:00
separate out "new" button implementations for extension refresh (#12002)
This commit is contained in:
parent
ca839b3d80
commit
2df8643e29
@ -104,72 +104,97 @@
|
|||||||
*ngIf="filter.type !== 'trash' && filter.collectionId !== Unassigned && organization"
|
*ngIf="filter.type !== 'trash' && filter.collectionId !== Unassigned && organization"
|
||||||
class="tw-shrink-0"
|
class="tw-shrink-0"
|
||||||
>
|
>
|
||||||
<div *ngIf="canCreateCipher && canCreateCollection" appListDropdown>
|
<!-- "New" menu is always shown for Extension Refresh unless the user cannot create a cipher -->
|
||||||
|
<ng-container *ngIf="extensionRefreshEnabled && canCreateCipher; else nonRefresh">
|
||||||
|
<div appListDropdown>
|
||||||
|
<button
|
||||||
|
bitButton
|
||||||
|
buttonType="primary"
|
||||||
|
type="button"
|
||||||
|
[bitMenuTriggerFor]="addOptions"
|
||||||
|
id="newItemDropdown"
|
||||||
|
appA11yTitle="{{ 'new' | i18n }}"
|
||||||
|
>
|
||||||
|
<i class="bwi bwi-plus-f" aria-hidden="true"></i>
|
||||||
|
{{ "new" | i18n }}<i class="bwi tw-ml-2" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
<bit-menu #addOptions aria-labelledby="newItemDropdown">
|
||||||
|
<button type="button" bitMenuItem (click)="addCipher(CipherType.Login)">
|
||||||
|
<i class="bwi bwi-globe" slot="start" aria-hidden="true"></i>
|
||||||
|
{{ "typeLogin" | i18n }}
|
||||||
|
</button>
|
||||||
|
<button type="button" bitMenuItem (click)="addCipher(CipherType.Card)">
|
||||||
|
<i class="bwi bwi-credit-card" slot="start" aria-hidden="true"></i>
|
||||||
|
{{ "typeCard" | i18n }}
|
||||||
|
</button>
|
||||||
|
<button type="button" bitMenuItem (click)="addCipher(CipherType.Identity)">
|
||||||
|
<i class="bwi bwi-id-card" slot="start" aria-hidden="true"></i>
|
||||||
|
{{ "typeIdentity" | i18n }}
|
||||||
|
</button>
|
||||||
|
<button type="button" bitMenuItem (click)="addCipher(CipherType.SecureNote)">
|
||||||
|
<i class="bwi bwi-sticky-note" slot="start" aria-hidden="true"></i>
|
||||||
|
{{ "note" | i18n }}
|
||||||
|
</button>
|
||||||
|
<ng-container *ngIf="canCreateCollection">
|
||||||
|
<bit-menu-divider></bit-menu-divider>
|
||||||
|
<button type="button" bitMenuItem (click)="addCollection()">
|
||||||
|
<i class="bwi bwi-fw bwi-collection" aria-hidden="true"></i>
|
||||||
|
{{ "collection" | i18n }}
|
||||||
|
</button>
|
||||||
|
</ng-container>
|
||||||
|
</bit-menu>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-template #nonRefresh>
|
||||||
|
<!-- Show a menu when the user can create a cipher and collection -->
|
||||||
|
<div *ngIf="canCreateCipher && canCreateCollection" appListDropdown>
|
||||||
|
<button
|
||||||
|
bitButton
|
||||||
|
buttonType="primary"
|
||||||
|
type="button"
|
||||||
|
[bitMenuTriggerFor]="addOptions"
|
||||||
|
id="newItemDropdown"
|
||||||
|
appA11yTitle="{{ 'new' | i18n }}"
|
||||||
|
>
|
||||||
|
<i class="bwi bwi-plus-f" aria-hidden="true"></i>
|
||||||
|
{{ "new" | i18n }}<i class="bwi tw-ml-2" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
<bit-menu #addOptions aria-labelledby="newItemDropdown">
|
||||||
|
<button type="button" bitMenuItem (click)="addCipher()">
|
||||||
|
<i class="bwi bwi-fw bwi-globe" aria-hidden="true"></i>
|
||||||
|
{{ "item" | i18n }}
|
||||||
|
</button>
|
||||||
|
<button type="button" bitMenuItem (click)="addCollection()">
|
||||||
|
<i class="bwi bwi-fw bwi-collection" aria-hidden="true"></i>
|
||||||
|
{{ "collection" | i18n }}
|
||||||
|
</button>
|
||||||
|
</bit-menu>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Show a single button when the user can only create a cipher -->
|
||||||
<button
|
<button
|
||||||
|
*ngIf="canCreateCipher && !canCreateCollection"
|
||||||
|
type="button"
|
||||||
bitButton
|
bitButton
|
||||||
buttonType="primary"
|
buttonType="primary"
|
||||||
type="button"
|
(click)="addCipher()"
|
||||||
[bitMenuTriggerFor]="addOptions"
|
|
||||||
id="newItemDropdown"
|
|
||||||
appA11yTitle="{{ 'new' | i18n }}"
|
|
||||||
>
|
>
|
||||||
<i class="bwi bwi-plus-f" aria-hidden="true"></i>
|
<i class="bwi bwi-plus bwi-fw" aria-hidden="true"></i>
|
||||||
{{ "new" | i18n }}<i class="bwi tw-ml-2" aria-hidden="true"></i>
|
{{ "newItem" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<bit-menu #addOptions aria-labelledby="newItemDropdown">
|
|
||||||
<ng-container [ngSwitch]="extensionRefreshEnabled">
|
|
||||||
<ng-container *ngSwitchCase="true">
|
|
||||||
<button type="button" bitMenuItem (click)="addCipher(CipherType.Login)">
|
|
||||||
<i class="bwi bwi-globe" slot="start" aria-hidden="true"></i>
|
|
||||||
{{ "typeLogin" | i18n }}
|
|
||||||
</button>
|
|
||||||
<button type="button" bitMenuItem (click)="addCipher(CipherType.Card)">
|
|
||||||
<i class="bwi bwi-credit-card" slot="start" aria-hidden="true"></i>
|
|
||||||
{{ "typeCard" | i18n }}
|
|
||||||
</button>
|
|
||||||
<button type="button" bitMenuItem (click)="addCipher(CipherType.Identity)">
|
|
||||||
<i class="bwi bwi-id-card" slot="start" aria-hidden="true"></i>
|
|
||||||
{{ "typeIdentity" | i18n }}
|
|
||||||
</button>
|
|
||||||
<button type="button" bitMenuItem (click)="addCipher(CipherType.SecureNote)">
|
|
||||||
<i class="bwi bwi-sticky-note" slot="start" aria-hidden="true"></i>
|
|
||||||
{{ "note" | i18n }}
|
|
||||||
</button>
|
|
||||||
<bit-menu-divider></bit-menu-divider>
|
|
||||||
</ng-container>
|
|
||||||
<ng-container *ngSwitchCase="false">
|
|
||||||
<button type="button" bitMenuItem (click)="addCipher()">
|
|
||||||
<i class="bwi bwi-fw bwi-globe" aria-hidden="true"></i>
|
|
||||||
{{ "item" | i18n }}
|
|
||||||
</button>
|
|
||||||
</ng-container>
|
|
||||||
</ng-container>
|
|
||||||
<button type="button" bitMenuItem (click)="addCollection()">
|
|
||||||
<i class="bwi bwi-fw bwi-collection" aria-hidden="true"></i>
|
|
||||||
{{ "collection" | i18n }}
|
|
||||||
</button>
|
|
||||||
</bit-menu>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
*ngIf="canCreateCipher && !canCreateCollection"
|
|
||||||
type="button"
|
|
||||||
bitButton
|
|
||||||
buttonType="primary"
|
|
||||||
(click)="addCipher()"
|
|
||||||
>
|
|
||||||
<i class="bwi bwi-plus bwi-fw" aria-hidden="true"></i>
|
|
||||||
{{ "newItem" | i18n }}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
<!-- Show a single button when the user can only create a collection -->
|
||||||
*ngIf="canCreateCollection && !canCreateCipher"
|
<button
|
||||||
type="button"
|
*ngIf="canCreateCollection && !canCreateCipher"
|
||||||
bitButton
|
type="button"
|
||||||
buttonType="primary"
|
bitButton
|
||||||
(click)="addCollection()"
|
buttonType="primary"
|
||||||
>
|
(click)="addCollection()"
|
||||||
<i class="bwi bwi-plus bwi-fw" aria-hidden="true"></i>
|
>
|
||||||
{{ "newCollection" | i18n }}
|
<i class="bwi bwi-plus bwi-fw" aria-hidden="true"></i>
|
||||||
</button>
|
{{ "newCollection" | i18n }}
|
||||||
|
</button>
|
||||||
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
</app-header>
|
</app-header>
|
||||||
|
@ -57,7 +57,7 @@ export class VaultHeaderComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
@Input() loading: boolean;
|
@Input() loading: boolean;
|
||||||
|
|
||||||
/** Current active fitler */
|
/** Current active filter */
|
||||||
@Input() filter: RoutedVaultFilterModel;
|
@Input() filter: RoutedVaultFilterModel;
|
||||||
|
|
||||||
/** The organization currently being viewed */
|
/** The organization currently being viewed */
|
||||||
|
Loading…
Reference in New Issue
Block a user