Exports the settings for the dialogs to a separate file.

- Includes a constant for small, medium and large dialogs.
This commit is contained in:
GabrielMeyer 2019-07-30 10:30:19 +02:00
parent 1ed9aab380
commit bd03300ee0
18 changed files with 75 additions and 108 deletions

View File

@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { mediumDialogSettings } from 'app/shared/utils/dialog-settings';
import {
ChoiceAnswer,
ChoiceDialogComponent,
@ -42,9 +43,7 @@ export class ChoiceService {
clearChoice?: string
): Promise<ChoiceAnswer> {
const dialogRef = this.dialog.open(ChoiceDialogComponent, {
maxWidth: '90vw',
maxHeight: '90vh',
disableClose: true,
...mediumDialogSettings,
data: {
title: title,
choices: choices,

View File

@ -5,6 +5,7 @@ import { MatDialog } from '@angular/material';
import { BehaviorSubject } from 'rxjs';
import { MediafileRepositoryService } from 'app/core/repositories/mediafiles/mediafile-repository.service';
import { mediumDialogSettings } from 'app/shared/utils/dialog-settings';
import { ViewMediafile } from 'app/site/mediafiles/models/view-mediafile';
@Component({
@ -51,11 +52,7 @@ export class AttachmentControlComponent implements OnInit, ControlValueAccessor
* @param dialog the dialog to open
*/
public openUploadDialog(dialog: TemplateRef<string>): void {
this.dialogService.open(dialog, {
width: '750px',
maxWidth: '90vw',
maxHeight: '90vh'
});
this.dialogService.open(dialog, mediumDialogSettings);
}
/**

View File

@ -9,6 +9,7 @@ import { Subscription } from 'rxjs';
import { NotifyResponse, NotifyService } from 'app/core/core-services/notify.service';
import { OperatorService } from 'app/core/core-services/operator.service';
import { mediumDialogSettings } from 'app/shared/utils/dialog-settings';
/**
* All player types.
@ -602,10 +603,7 @@ export class CopyrightSignComponent {
if (this.clickCounter === 5) {
this.clickCounter = 0;
this.dialog.open(C4DialogComponent, {
width: '550px',
disableClose: true
});
this.dialog.open(C4DialogComponent, mediumDialogSettings);
} else {
this.clickTimeout = <any>setTimeout(() => {
this.clickCounter = 0;

View File

@ -0,0 +1,31 @@
/**
* General settings all dialogs are using.
*/
const generalSettings = { disableClose: true, maxWidth: '90vw', maxHeight: '90vh' };
/**
* Settings to display a large (wide) dialog.
* `width='1100px'`
*/
export const largeDialogSettings = {
width: '1100px',
...generalSettings
};
/**
* Settings to display a medium dialog.
* `width='750px'`
*/
export const mediumDialogSettings = {
width: '750px',
...generalSettings
};
/**
* Settings to display a small dialog. Useful for info-dialogs.
* `width='400px'`
*/
export const infoDialogSettings = {
width: '400px',
...generalSettings
};

View File

@ -22,6 +22,7 @@ import { PdfDocumentService } from 'app/core/ui-services/pdf-document.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { ViewportService } from 'app/core/ui-services/viewport.service';
import { ColumnRestriction } from 'app/shared/components/list-view-table/list-view-table.component';
import { infoDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseListViewComponent } from 'app/site/base/base-list-view';
import { ProjectorElementBuildDeskriptor } from 'app/site/base/projectable';
import { ViewTopic } from 'app/site/topics/models/view-topic';
@ -190,11 +191,7 @@ export class AgendaListComponent extends BaseListViewComponent<ViewItem> impleme
if (this.isMultiSelect || !this.canManage) {
return;
}
const dialogRef = this.dialog.open(ItemInfoDialogComponent, {
width: '400px',
data: item,
disableClose: true
});
const dialogRef = this.dialog.open(ItemInfoDialogComponent, infoDialogSettings);
dialogRef.afterClosed().subscribe(result => {
if (result) {

View File

@ -10,6 +10,7 @@ import { OperatorService } from 'app/core/core-services/operator.service';
import { AssignmentRepositoryService } from 'app/core/repositories/assignments/assignment-repository.service';
import { CalculablePollKey, MajorityMethod } from 'app/core/ui-services/poll.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { mediumDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseViewComponent } from 'app/site/base/base-view';
import { AssignmentPollDialogComponent } from '../assignment-poll-dialog/assignment-poll-dialog.component';
import { AssignmentPollPdfService } from '../../services/assignment-poll-pdf.service';
@ -197,10 +198,7 @@ export class AssignmentPollComponent extends BaseViewComponent implements OnInit
const dialogRef = this.dialog.open(AssignmentPollDialogComponent, {
// TODO deep copy of this.poll (JSON parse is ugly workaround) or sending just copy of the options
data: this.poll.copy(),
maxHeight: '90vh',
width: '600px',
maxWidth: '90vw',
disableClose: true
...mediumDialogSettings
});
dialogRef.afterClosed().subscribe(result => {
if (result) {

View File

@ -25,6 +25,7 @@ import { MediaManageService } from 'app/core/ui-services/media-manage.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { ViewportService } from 'app/core/ui-services/viewport.service';
import { Mediafile } from 'app/shared/models/mediafiles/mediafile';
import { infoDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseViewComponent } from 'app/site/base/base-view';
import { ViewMediafile } from 'app/site/mediafiles/models/view-mediafile';
import { ViewGroup } from 'app/site/users/models/view-group';
@ -306,12 +307,7 @@ export class MediafileListComponent extends BaseViewComponent implements OnInit,
access_groups_id: [file.access_groups_id]
});
const dialogRef = this.dialog.open(this.fileEditDialog, {
width: '400px',
maxWidth: '90vw',
maxHeight: '90vh',
disableClose: true
});
const dialogRef = this.dialog.open(this.fileEditDialog, infoDialogSettings);
dialogRef.keydownEvents().subscribe((event: KeyboardEvent) => {
if (event.key === 'Enter' && event.shiftKey && this.fileEditForm.valid) {
@ -410,9 +406,7 @@ export class MediafileListComponent extends BaseViewComponent implements OnInit,
public createNewFolder(templateRef: TemplateRef<string>): void {
this.newDirectoryForm.reset();
const dialogRef = this.dialog.open(templateRef, {
width: '400px'
});
const dialogRef = this.dialog.open(templateRef, infoDialogSettings);
dialogRef.afterClosed().subscribe(result => {
if (result) {
@ -428,9 +422,7 @@ export class MediafileListComponent extends BaseViewComponent implements OnInit,
public move(templateRef: TemplateRef<string>, mediafile: ViewMediafile): void {
this.newDirectoryForm.reset();
const dialogRef = this.dialog.open(templateRef, {
width: '400px'
});
const dialogRef = this.dialog.open(templateRef, infoDialogSettings);
dialogRef.afterClosed().subscribe(result => {
if (result) {

View File

@ -12,6 +12,7 @@ import { OperatorService } from 'app/core/core-services/operator.service';
import { CategoryRepositoryService } from 'app/core/repositories/motions/category-repository.service';
import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { infoDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseViewComponent } from 'app/site/base/base-view';
import { ViewCategory } from 'app/site/motions/models/view-category';
import { ViewMotion } from 'app/site/motions/models/view-motion';
@ -198,12 +199,7 @@ export class CategoryDetailComponent extends BaseViewComponent implements OnInit
name: [this.selectedCategory.name, Validators.required]
});
this.dialog.open(this.editDialog, {
width: '400px',
maxWidth: '90vw',
maxHeight: '90vh',
disableClose: true
});
this.dialog.open(this.editDialog, infoDialogSettings);
}
/**

View File

@ -13,6 +13,7 @@ import { MotionBlockRepositoryService } from 'app/core/repositories/motions/moti
import { MotionRepositoryService } from 'app/core/repositories/motions/motion-repository.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { MotionBlock } from 'app/shared/models/motions/motion-block';
import { infoDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseViewComponent } from 'app/site/base/base-view';
import { ViewMotion } from 'app/site/motions/models/view-motion';
import { ViewMotionBlock } from 'app/site/motions/models/view-motion-block';
@ -219,12 +220,7 @@ export class MotionBlockDetailComponent extends BaseViewComponent implements OnI
internal: [this.block.internal]
});
const dialogRef = this.dialog.open(this.editDialog, {
width: '400px',
maxWidth: '90vw',
maxHeight: '90vh',
disableClose: true
});
const dialogRef = this.dialog.open(this.editDialog, infoDialogSettings);
dialogRef.keydownEvents().subscribe((event: KeyboardEvent) => {
if (event.key === 'Enter' && event.shiftKey) {

View File

@ -10,6 +10,7 @@ import { ConfigService } from 'app/core/ui-services/config.service';
import { DiffService, LineRange } from 'app/core/ui-services/diff.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { ViewUnifiedChange, ViewUnifiedChangeType } from 'app/shared/models/motions/view-unified-change';
import { mediumDialogSettings } from 'app/shared/utils/dialog-settings';
import { getRecommendationTypeName } from 'app/shared/utils/recommendation-type-names';
import { BaseViewComponent } from 'app/site/base/base-view';
import { LineNumberingMode, ViewMotion } from 'app/site/motions/models/view-motion';
@ -324,12 +325,8 @@ export class MotionDetailDiffComponent extends BaseViewComponent implements Afte
changeRecommendation: reco
};
this.dialogService.open(MotionChangeRecommendationDialogComponent, {
height: '600px',
width: '800px',
maxHeight: '90vh',
maxWidth: '90vw',
data: data,
disableClose: true
...mediumDialogSettings,
data: data
});
}
@ -343,12 +340,8 @@ export class MotionDetailDiffComponent extends BaseViewComponent implements Afte
changeRecommendation: reco
};
this.dialogService.open(MotionTitleChangeRecommendationDialogComponent, {
height: '600px',
width: '800px',
maxHeight: '90vh',
maxWidth: '90vw',
data: data,
disableClose: true
...mediumDialogSettings,
data: data
});
}

View File

@ -30,6 +30,7 @@ import { ViewportService } from 'app/core/ui-services/viewport.service';
import { Mediafile } from 'app/shared/models/mediafiles/mediafile';
import { Motion } from 'app/shared/models/motions/motion';
import { ViewUnifiedChange } from 'app/shared/models/motions/view-unified-change';
import { infoDialogSettings, mediumDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseViewComponent } from 'app/site/base/base-view';
import { CreateMotion } from 'app/site/motions/models/create-motion';
import { ViewCategory } from 'app/site/motions/models/view-category';
@ -1037,12 +1038,8 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
)
};
this.dialogService.open(MotionChangeRecommendationDialogComponent, {
height: '600px',
width: '800px',
maxHeight: '90vh',
maxWidth: '90vw',
data: data,
disableClose: true
...mediumDialogSettings,
data: data
});
}
@ -1059,11 +1056,8 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit,
)
};
this.dialogService.open(MotionTitleChangeRecommendationDialogComponent, {
width: '400px',
maxHeight: '90vh',
maxWidth: '90vw',
data: data,
disableClose: true
...infoDialogSettings,
data: data
});
}

View File

@ -8,6 +8,7 @@ import { MotionRepositoryService } from 'app/core/repositories/motions/motion-re
import { CalculablePollKey } from 'app/core/ui-services/poll.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { MotionPoll } from 'app/shared/models/motions/motion-poll';
import { infoDialogSettings } from 'app/shared/utils/dialog-settings';
import { LocalPermissionsService } from 'app/site/motions/services/local-permissions.service';
import { MotionPollPdfService } from 'app/site/motions/services/motion-poll-pdf.service';
import { MotionPollService } from 'app/site/motions/services/motion-poll.service';
@ -184,9 +185,7 @@ export class MotionPollComponent implements OnInit {
public editPoll(): void {
const dialogRef = this.dialog.open(MotionPollDialogComponent, {
data: { ...this.poll },
maxHeight: '90vh',
minWidth: '250px',
disableClose: true
...infoDialogSettings
});
dialogRef.afterClosed().subscribe(result => {
if (result) {

View File

@ -16,6 +16,7 @@ import { TagRepositoryService } from 'app/core/repositories/tags/tag-repository.
import { ConfigService } from 'app/core/ui-services/config.service';
import { PdfError } from 'app/core/ui-services/pdf-document.service';
import { ColumnRestriction } from 'app/shared/components/list-view-table/list-view-table.component';
import { infoDialogSettings, largeDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseListViewComponent } from 'app/site/base/base-list-view';
import { ViewCategory } from 'app/site/motions/models/view-category';
import { ViewMotion } from 'app/site/motions/models/view-motion';
@ -300,9 +301,7 @@ export class MotionListComponent extends BaseListViewComponent<ViewMotion> imple
*/
public openExportDialog(): void {
const exportDialogRef = this.dialog.open(MotionExportDialogComponent, {
width: '1100px',
maxWidth: '90vw',
maxHeight: '90vh',
...largeDialogSettings,
data: this.dataSource
});
@ -447,12 +446,7 @@ export class MotionListComponent extends BaseListViewComponent<ViewMotion> imple
// Copies the interface to check, if changes were made.
const copyDialog = { ...this.infoDialog };
const dialogRef = this.dialog.open(this.motionInfoDialog, {
width: '400px',
maxWidth: '90vw',
maxHeight: '90vh',
disableClose: true
});
const dialogRef = this.dialog.open(this.motionInfoDialog, infoDialogSettings);
dialogRef.keydownEvents().subscribe((event: KeyboardEvent) => {
if (event.key === 'Enter' && event.shiftKey) {

View File

@ -13,6 +13,7 @@ import { StateRepositoryService } from 'app/core/repositories/motions/state-repo
import { WorkflowRepositoryService } from 'app/core/repositories/motions/workflow-repository.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { MergeAmendment, State } from 'app/shared/models/motions/state';
import { infoDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseViewComponent } from 'app/site/base/base-view';
import { ViewState } from 'app/site/motions/models/view-state';
import { ViewWorkflow } from 'app/site/motions/models/view-workflow';
@ -344,11 +345,7 @@ export class WorkflowDetailComponent extends BaseViewComponent implements OnInit
deletable: deletable
};
const dialogRef = this.dialog.open(this.workflowDialog, {
maxHeight: '90vh',
width: '400px',
maxWidth: '90vw'
});
const dialogRef = this.dialog.open(this.workflowDialog, infoDialogSettings);
return dialogRef.afterClosed();
}

View File

@ -10,6 +10,7 @@ import { StorageService } from 'app/core/core-services/storage.service';
import { WorkflowRepositoryService } from 'app/core/repositories/motions/workflow-repository.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { Workflow } from 'app/shared/models/motions/workflow';
import { infoDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseListViewComponent } from 'app/site/base/base-list-view';
import { ViewWorkflow } from 'app/site/motions/models/view-workflow';
@ -76,9 +77,7 @@ export class WorkflowListComponent extends BaseListViewComponent<ViewWorkflow> i
*/
public onNewButton(templateRef: TemplateRef<string>): void {
this.newWorkflowTitle = '';
const dialogRef = this.dialog.open(templateRef, {
width: '400px'
});
const dialogRef = this.dialog.open(templateRef, infoDialogSettings);
dialogRef.afterClosed().subscribe(result => {
if (result) {

View File

@ -18,6 +18,7 @@ import { DurationService } from 'app/core/ui-services/duration.service';
import { Countdown } from 'app/shared/models/core/countdown';
import { ProjectorElement } from 'app/shared/models/core/projector';
import { ProjectorMessage } from 'app/shared/models/core/projector-message';
import { infoDialogSettings, mediumDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseViewComponent } from 'app/site/base/base-view';
import { Projectable } from 'app/site/base/projectable';
import { ViewCountdown } from 'app/site/projector/models/view-countdown';
@ -207,10 +208,7 @@ export class ProjectorDetailComponent extends BaseViewComponent implements OnIni
const dialogRef = this.dialog.open(CountdownDialogComponent, {
data: countdownData,
maxHeight: '90vh',
width: '400px',
maxWidth: '90vw',
disableClose: true
...infoDialogSettings
});
dialogRef.afterClosed().subscribe(result => {
@ -238,10 +236,7 @@ export class ProjectorDetailComponent extends BaseViewComponent implements OnIni
const dialogRef = this.dialog.open(MessageDialogComponent, {
data: messageData,
maxHeight: '90vh',
width: '800px',
maxWidth: '90vw',
disableClose: true
...mediumDialogSettings
});
dialogRef.afterClosed().subscribe(result => {

View File

@ -10,6 +10,7 @@ import { TranslateService } from '@ngx-translate/core';
import { AppPermissions, GroupRepositoryService } from 'app/core/repositories/users/group-repository.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { Group } from 'app/shared/models/users/group';
import { infoDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseViewComponent } from 'app/site/base/base-view';
import { ViewGroup } from '../../models/view-group';
@ -96,12 +97,7 @@ export class GroupListComponent extends BaseViewComponent implements OnInit {
name: [name, Validators.required]
});
const dialogRef = this.dialog.open(this.groupEditDialog, {
width: '400px',
maxWidth: '90vw',
maxHeight: '90vh',
disableClose: true
});
const dialogRef = this.dialog.open(this.groupEditDialog, infoDialogSettings);
dialogRef.keydownEvents().subscribe((event: KeyboardEvent) => {
if (event.key === 'Enter' && event.shiftKey && this.groupForm.valid) {

View File

@ -17,6 +17,7 @@ import { ConfigService } from 'app/core/ui-services/config.service';
import { CsvExportService } from 'app/core/ui-services/csv-export.service';
import { PromptService } from 'app/core/ui-services/prompt.service';
import { genders } from 'app/shared/models/users/user';
import { infoDialogSettings } from 'app/shared/utils/dialog-settings';
import { BaseListViewComponent } from 'app/site/base/base-list-view';
import { UserFilterListService } from '../../services/user-filter-list.service';
import { UserPdfExportService } from '../../services/user-pdf-export.service';
@ -219,12 +220,7 @@ export class UserListComponent extends BaseListViewComponent<ViewUser> implement
number: user.number
};
const dialogRef = this.dialog.open(this.userInfoDialog, {
width: '400px',
maxWidth: '90vw',
maxHeight: '90vh',
disableClose: true
});
const dialogRef = this.dialog.open(this.userInfoDialog, infoDialogSettings);
dialogRef.keydownEvents().subscribe((event: KeyboardEvent) => {
if (event.key === 'Enter' && event.shiftKey) {