mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-06 09:20:43 +01:00
Close popout instead of navigating, style fixes
This commit is contained in:
parent
bef1008b9d
commit
092110fd5f
@ -274,9 +274,8 @@
|
||||
<a class="box-content-row box-content-row-flex text-default" href="#" appStopClick appBlurClick
|
||||
(click)="attachments()" *ngIf="editMode && showAttachments && !cloneMode">
|
||||
<div class="row-main">{{'attachments' | i18n}}</div>
|
||||
<i class="fa fa-chevron-right row-sub-icon" aria-hidden="true"
|
||||
*ngIf="!openAttachmentsInPopup()"></i>
|
||||
<i class="fa fa-external-link fa-lg fa-fw" aria-hidden="true" *ngIf="openAttachmentsInPopup()"></i>
|
||||
<i class="fa fa-external-link fa-lg fa-fw" aria-hidden="true" *ngIf="openAttachmentsInPopup"></i>
|
||||
<i class="fa fa-chevron-right row-sub-icon" aria-hidden="true" *ngIf="!openAttachmentsInPopup"></i>
|
||||
</a>
|
||||
<a class="box-content-row box-content-row-flex text-default" href="#" appStopClick appBlurClick
|
||||
(click)="editCollections()" *ngIf="editMode && cipher.organizationId && !cloneMode">
|
||||
|
@ -31,6 +31,7 @@ import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/componen
|
||||
export class AddEditComponent extends BaseAddEditComponent {
|
||||
currentUris: string[];
|
||||
showAttachments = true;
|
||||
openAttachmentsInPopup: boolean;
|
||||
|
||||
constructor(cipherService: CipherService, folderService: FolderService,
|
||||
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||
@ -83,6 +84,8 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
if (queryParamsSub != null) {
|
||||
queryParamsSub.unsubscribe();
|
||||
}
|
||||
|
||||
this.openAttachmentsInPopup = this.popupUtilsService.inPopup(window);
|
||||
});
|
||||
|
||||
if (!this.editMode) {
|
||||
@ -118,9 +121,9 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
attachments() {
|
||||
super.attachments();
|
||||
|
||||
if (this.openAttachmentsInPopup()) {
|
||||
let destinationUrl = this.router.createUrlTree(['/attachments'], { queryParams: { cipherId: this.cipher.id } }).toString();
|
||||
let currentBaseUrl = window.location.href.replace(this.router.url, '');
|
||||
if (this.openAttachmentsInPopup) {
|
||||
const destinationUrl = this.router.createUrlTree(['/attachments'], { queryParams: { cipherId: this.cipher.id } }).toString();
|
||||
const currentBaseUrl = window.location.href.replace(this.router.url, '');
|
||||
this.popupUtilsService.popOut(window, currentBaseUrl + destinationUrl);
|
||||
} else {
|
||||
this.router.navigate(['/attachments'], { queryParams: { cipherId: this.cipher.id } });
|
||||
@ -170,8 +173,4 @@ export class AddEditComponent extends BaseAddEditComponent {
|
||||
return (!this.editMode || this.cloneMode) && this.ownershipOptions
|
||||
&& (this.ownershipOptions.length > 1 || !this.allowPersonal);
|
||||
}
|
||||
|
||||
openAttachmentsInPopup(): boolean {
|
||||
return this.popupUtilsService.inPopup(window);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
<form #form (ngSubmit)="submit()" [appApiAction]="formPromise">
|
||||
<header>
|
||||
<div class="left">
|
||||
<button type="button" appBlurClick (click)="back()">
|
||||
<button type="button" appBlurClick (click)="close()" *ngIf="openedAttachmentsInPopup">
|
||||
{{'close' | i18n}}
|
||||
</button>
|
||||
<button type="button" appBlurClick (click)="back()" *ngIf="!openedAttachmentsInPopup">
|
||||
<span class="header-icon"><i class="fa fa-chevron-left" aria-hidden="true"></i></span>
|
||||
<span>{{'back' | i18n}}</span>
|
||||
</button>
|
||||
|
@ -15,6 +15,8 @@ import { AttachmentsComponent as BaseAttachmentsComponent } from 'jslib/angular/
|
||||
templateUrl: 'attachments.component.html',
|
||||
})
|
||||
export class AttachmentsComponent extends BaseAttachmentsComponent {
|
||||
openedAttachmentsInPopup: boolean;
|
||||
|
||||
constructor(cipherService: CipherService, i18nService: I18nService,
|
||||
cryptoService: CryptoService, userService: UserService,
|
||||
platformUtilsService: PlatformUtilsService, private location: Location,
|
||||
@ -30,13 +32,15 @@ export class AttachmentsComponent extends BaseAttachmentsComponent {
|
||||
queryParamsSub.unsubscribe();
|
||||
}
|
||||
});
|
||||
|
||||
this.openedAttachmentsInPopup = history.length === 1;
|
||||
}
|
||||
|
||||
back() {
|
||||
if (document.referrer === "") {
|
||||
this.router.navigate(['/edit-cipher'], { queryParams: { cipherId: this.cipher.id } });
|
||||
} else {
|
||||
this.location.back();
|
||||
}
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
close() {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user