Remove redundant Submits
Remove concurrent ngSubmit Some cleanup and code alignment
This commit is contained in:
parent
98dc105f46
commit
6a78d65dc3
@ -82,7 +82,6 @@ export class ItemRepositoryService extends BaseRepository<ViewItem, Item> {
|
||||
|
||||
/**
|
||||
* Returns the corresponding content object to a given {@link Item} as an {@link AgendaBaseViewModel}
|
||||
* Used dynamically because of heavy race conditions
|
||||
*
|
||||
* @param agendaItem the target agenda Item
|
||||
* @returns the content object of the given item. Might be null if it was not found.
|
||||
|
@ -111,14 +111,13 @@ export class AgendaListComponent extends ListViewBaseComponent<ViewItem> impleme
|
||||
|
||||
/**
|
||||
* Links to the content object.
|
||||
* Gets content object from the repository rather than from the model
|
||||
* to avoid race conditions
|
||||
*
|
||||
* @param item the item that was selected from the list view
|
||||
*/
|
||||
public singleSelectAction(item: ViewItem): void {
|
||||
const contentObject = this.repo.getContentObject(item.item);
|
||||
this.router.navigate([contentObject.getDetailStateURL()]);
|
||||
if (item.contentObject) {
|
||||
this.router.navigate([item.contentObject.getDetailStateURL()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
<h1 mat-dialog-title>{{ 'Edit details for' | translate }} {{ item.getTitle() }}</h1>
|
||||
<div mat-dialog-content>
|
||||
<form class="itemDialogForm" [formGroup]="agendaInfoForm" (keydown)="onKeyDown($event)" (ngSubmit)="saveItemInfo()">
|
||||
<form class="itemDialogForm" [formGroup]="agendaInfoForm" (keydown)="onKeyDown($event)">
|
||||
<!-- Visibility -->
|
||||
<mat-form-field>
|
||||
<mat-select formControlName="type" placeholder="{{ 'Agenda visibility' | translate }}">
|
||||
|
@ -24,9 +24,7 @@
|
||||
</div>
|
||||
</os-head-bar>
|
||||
|
||||
<mat-card *ngIf="topic || editTopic"
|
||||
[ngClass]="editTopic ? 'os-form-card' : 'os-card'"
|
||||
class="on-transition-fade">
|
||||
<mat-card *ngIf="topic || editTopic" [ngClass]="editTopic ? 'os-form-card' : 'os-card'" class="on-transition-fade">
|
||||
<div *ngIf="!editTopic">
|
||||
<h1>{{ topic.title }}</h1>
|
||||
</div>
|
||||
@ -49,7 +47,7 @@
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<form *ngIf="editTopic" [formGroup]="topicForm" (keydown)="onKeyDown($event)" (ngSubmit)="saveTopic()">
|
||||
<form *ngIf="editTopic" [formGroup]="topicForm" (keydown)="onKeyDown($event)">
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<input
|
||||
|
@ -2,14 +2,28 @@
|
||||
<form [formGroup]="newPasswordForm" (ngSubmit)="submitNewPassword()">
|
||||
<h3 translate>Please enter your new password</h3>
|
||||
<mat-form-field>
|
||||
<input matInput required placeholder="{{ 'New password' | translate }}" formControlName="password" type="password">
|
||||
<input
|
||||
matInput
|
||||
required
|
||||
placeholder="{{ 'New password' | translate }}"
|
||||
formControlName="password"
|
||||
type="password"
|
||||
/>
|
||||
<mat-error *ngIf="newPasswordForm.get('password').hasError('required')" translate>
|
||||
A password is required
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<br>
|
||||
<button mat-raised-button color="primary" class="submit-button" [disabled]="newPasswordForm.invalid"
|
||||
type="submit" translate>Reset password</button>
|
||||
<button mat-button class="back-button" routerLink="/login" translate>Back to login</button>
|
||||
<br />
|
||||
<button
|
||||
type="submit"
|
||||
mat-raised-button
|
||||
color="primary"
|
||||
class="submit-button"
|
||||
[disabled]="newPasswordForm.invalid"
|
||||
translate
|
||||
>
|
||||
Reset password
|
||||
</button>
|
||||
<button type="button" class="back-button" routerLink="/login" translate>Back to login</button>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -2,14 +2,21 @@
|
||||
<form [formGroup]="resetPasswordForm" (ngSubmit)="resetPassword()">
|
||||
<h3 translate>Enter your email to send the password reset link</h3>
|
||||
<mat-form-field>
|
||||
<input matInput required placeholder="{{ 'Email' | translate }}" formControlName="email" type="email">
|
||||
<input matInput required placeholder="{{ 'Email' | translate }}" formControlName="email" type="email" />
|
||||
<mat-error *ngIf="resetPasswordForm.get('email').invalid" translate>
|
||||
Please enter a valid email address!
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<br>
|
||||
<button mat-raised-button color="primary" class="submit-button" [disabled]="resetPasswordForm.invalid"
|
||||
type="submit">{{ 'Reset password' | translate }}</button>
|
||||
<button mat-button routerLink="/login">{{ 'Back' | translate }}</button>
|
||||
<br />
|
||||
<button
|
||||
type="submit"
|
||||
mat-raised-button
|
||||
color="primary"
|
||||
class="submit-button"
|
||||
[disabled]="resetPasswordForm.invalid"
|
||||
>
|
||||
{{ 'Reset password' | translate }}</button
|
||||
>
|
||||
<button type="button" mat-button routerLink="/login">{{ 'Back' | translate }}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -3,7 +3,8 @@
|
||||
[editMode]="editFile"
|
||||
[multiSelectMode]="isMultiSelect"
|
||||
(mainEvent)="onMainEvent()"
|
||||
(saveEvent)="onSaveEditedFile()">
|
||||
(saveEvent)="onSaveEditedFile()"
|
||||
>
|
||||
<!-- Title -->
|
||||
<div class="title-slot">
|
||||
<h2 *ngIf="!editFile" translate>Files</h2>
|
||||
@ -13,7 +14,8 @@
|
||||
*ngIf="editFile"
|
||||
[formGroup]="fileEditForm"
|
||||
(ngSubmit)="onSaveEditedFile()"
|
||||
(keydown)="keyDownFunction($event)">
|
||||
(keydown)="keyDownFunction($event)"
|
||||
>
|
||||
<mat-form-field>
|
||||
<input
|
||||
type="text"
|
||||
@ -21,7 +23,8 @@
|
||||
osAutofocus
|
||||
required
|
||||
formControlName="title"
|
||||
placeholder="{{ 'New file name' | translate }}"/>
|
||||
placeholder="{{ 'New file name' | translate }}"
|
||||
/>
|
||||
<mat-error *ngIf="fileEditForm.invalid" translate>Required</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
@ -45,12 +48,15 @@
|
||||
<button mat-icon-button (click)="toggleMultiSelect()"><mat-icon>arrow_back</mat-icon></button>
|
||||
<span>{{ selectedRows.length }} </span><span translate>selected</span>
|
||||
</div>
|
||||
|
||||
</os-head-bar>
|
||||
|
||||
<mat-drawer-container class="on-transition-fade">
|
||||
<os-sort-filter-bar [filterCount]="filteredCount" [sortService]="sortService" [filterService]="filterService"
|
||||
(searchFieldChange)="searchFilter($event)">
|
||||
<os-sort-filter-bar
|
||||
[filterCount]="filteredCount"
|
||||
[sortService]="sortService"
|
||||
[filterService]="filterService"
|
||||
(searchFieldChange)="searchFilter($event)"
|
||||
>
|
||||
</os-sort-filter-bar>
|
||||
<mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort>
|
||||
<!-- Selector Column -->
|
||||
@ -88,7 +94,8 @@
|
||||
*ngIf="getFileSettings(file).length > 0"
|
||||
[matMenuTriggerFor]="singleFileMenu"
|
||||
[matMenuTriggerData]="{ file: file }"
|
||||
[matTooltip]="formatIndicatorTooltip(file)">
|
||||
[matTooltip]="formatIndicatorTooltip(file)"
|
||||
>
|
||||
<mat-icon *ngIf="file.isFont()">text_fields</mat-icon>
|
||||
<mat-icon *ngIf="file.isImage()">insert_photo</mat-icon>
|
||||
</div>
|
||||
@ -119,14 +126,18 @@
|
||||
<!-- Exclusive for images -->
|
||||
<div *ngIf="file.isImage()">
|
||||
<div *ngFor="let action of logoActions">
|
||||
<ng-container *ngTemplateOutlet="manageButton; context: { file: file, action: action }"></ng-container>
|
||||
<ng-container
|
||||
*ngTemplateOutlet="manageButton; context: { file: file, action: action }"
|
||||
></ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Exclusive for fonts -->
|
||||
<div *ngIf="file.isFont()">
|
||||
<div *ngFor="let action of fontActions">
|
||||
<ng-container *ngTemplateOutlet="manageButton; context: { file: file, action: action }"></ng-container>
|
||||
<ng-container
|
||||
*ngTemplateOutlet="manageButton; context: { file: file, action: action }"
|
||||
></ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -170,7 +181,7 @@
|
||||
<span translate>Deselect all</span>
|
||||
</button>
|
||||
<mat-divider></mat-divider>
|
||||
<button mat-menu-item *ngIf="canEdit" (click)="deleteSelected()">
|
||||
<button mat-menu-item *osPerms="'mediafiles.can_manage'" (click)="deleteSelected()">
|
||||
<mat-icon>delete</mat-icon>
|
||||
<span translate>Delete</span>
|
||||
</button>
|
||||
|
@ -26,7 +26,8 @@
|
||||
type="button"
|
||||
mat-button
|
||||
matStepperNext
|
||||
[disabled]="contentForm.value.selectedParagraph === null">
|
||||
[disabled]="contentForm.value.selectedParagraph === null"
|
||||
>
|
||||
<span translate>Next</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -420,13 +420,7 @@
|
||||
</ng-template>
|
||||
|
||||
<ng-template #contentTemplate>
|
||||
<form
|
||||
class="motion-content"
|
||||
[formGroup]="contentForm"
|
||||
(keydown)="onKeyDown($event)"
|
||||
(ngSubmit)="saveMotion()"
|
||||
*ngIf="motion"
|
||||
>
|
||||
<form class="motion-content" [formGroup]="contentForm" (keydown)="onKeyDown($event)" *ngIf="motion">
|
||||
<!-- Line Number and Diff buttons -->
|
||||
<div *ngIf="!editMotion && !motion.isStatuteAmendment()" class="motion-text-controls">
|
||||
<mat-form-field class="motion-goto-line" *ngIf="highlightedLineOpened">
|
||||
|
@ -1,12 +1,24 @@
|
||||
<os-head-bar [mainButton]="true" [nav]="true" [editMode]="editTag"
|
||||
(mainEvent)="setEditMode(!editTag)" (saveEvent)="saveTag()" [multiSelectMode]="isMultiSelect">>
|
||||
<os-head-bar
|
||||
[mainButton]="true"
|
||||
[nav]="true"
|
||||
[editMode]="editTag"
|
||||
(mainEvent)="setEditMode(!editTag)"
|
||||
(saveEvent)="saveTag()"
|
||||
[multiSelectMode]="isMultiSelect"
|
||||
>
|
||||
<!-- Title -->
|
||||
<div class="title-slot">
|
||||
<h2 *ngIf="!editTag && !newTag" translate>Tags</h2>
|
||||
<form *ngIf="editTag" [formGroup]="tagForm" (ngSubmit)="saveTag()" (keydown)="keyDownFunction($event)">
|
||||
<form *ngIf="editTag" [formGroup]="tagForm" (keydown)="keyDownFunction($event)">
|
||||
<mat-form-field>
|
||||
<input type="text" matInput osAutofocus required formControlName="name"
|
||||
placeholder="{{ 'New tag name' | translate}}">
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
osAutofocus
|
||||
required
|
||||
formControlName="name"
|
||||
placeholder="{{ 'New tag name' | translate }}"
|
||||
/>
|
||||
<mat-error *ngIf="tagForm.invalid" translate>Required</mat-error>
|
||||
</mat-form-field>
|
||||
</form>
|
||||
@ -14,12 +26,11 @@
|
||||
|
||||
<!-- remove button -->
|
||||
<div class="extra-controls-slot on-transition-fade">
|
||||
<button *ngIf="!isMultiSelect && editTag && !newTag" type="button" mat-button (click)="deleteSelectedTag()">
|
||||
<button type="button" mat-button *ngIf="!isMultiSelect && editTag && !newTag" (click)="deleteSelectedTag()">
|
||||
<mat-icon>delete</mat-icon>
|
||||
<span translate>Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</os-head-bar>
|
||||
|
||||
<mat-table class="os-listview-table on-transition-fade" [dataSource]="dataSource" matSort>
|
||||
@ -28,7 +39,7 @@
|
||||
<mat-cell *matCellDef="let tag">{{ tag.getTitle() }}</mat-cell>
|
||||
</ng-container>
|
||||
<mat-header-row *matHeaderRowDef="['name']"></mat-header-row>
|
||||
<mat-row (click)='selectItem(row, $event)' *matRowDef="let row; columns: ['name']"></mat-row>
|
||||
<mat-row (click)="selectItem(row, $event)" *matRowDef="let row; columns: ['name']"></mat-row>
|
||||
</mat-table>
|
||||
|
||||
<mat-paginator class="on-transition-fade" [pageSizeOptions]="[25, 50, 75, 100, 125]"></mat-paginator>
|
||||
|
@ -15,12 +15,7 @@
|
||||
|
||||
<!-- Menu -->
|
||||
<div class="menu-slot">
|
||||
<button
|
||||
type="button"
|
||||
mat-icon-button
|
||||
*ngIf="isAllowed('changePersonal')"
|
||||
[matMenuTriggerFor]="userExtraMenu"
|
||||
>
|
||||
<button type="button" mat-icon-button *ngIf="isAllowed('changePersonal')" [matMenuTriggerFor]="userExtraMenu">
|
||||
<mat-icon>more_vert</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
@ -49,7 +44,6 @@
|
||||
<form
|
||||
[ngClass]="{ 'mat-form-field-enabled': editUser }"
|
||||
[formGroup]="personalInfoForm"
|
||||
(ngSubmit)="saveUser()"
|
||||
*ngIf="user"
|
||||
(keydown)="onKeyDown($event)"
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user