Fix Shift-Enter to save poll
Fixes a bug which caused the event listener not to register in BasePollDialog Also hot fixes a bug in babel
This commit is contained in:
parent
5617b02804
commit
5bf3dfadff
@ -82,6 +82,7 @@
|
|||||||
"@angular/compiler-cli": "^8.2.14",
|
"@angular/compiler-cli": "^8.2.14",
|
||||||
"@angular/language-service": "^8.2.14",
|
"@angular/language-service": "^8.2.14",
|
||||||
"@biesbjerg/ngx-translate-extract": "^3.0.5",
|
"@biesbjerg/ngx-translate-extract": "^3.0.5",
|
||||||
|
"@babel/compat-data": "~7.8.0",
|
||||||
"@compodoc/compodoc": "^1.1.11",
|
"@compodoc/compodoc": "^1.1.11",
|
||||||
"@types/jasmine": "^3.5.0",
|
"@types/jasmine": "^3.5.0",
|
||||||
"@types/jasminewd2": "^2.0.8",
|
"@types/jasminewd2": "^2.0.8",
|
||||||
|
@ -13,10 +13,10 @@ describe('AssignmentPollDialogComponent', () => {
|
|||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [E2EImportsModule],
|
imports: [E2EImportsModule],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: MatDialogRef, useValue: {} },
|
{ provide: MatDialogRef, useValue: null },
|
||||||
{
|
{
|
||||||
provide: MAT_DIALOG_DATA,
|
provide: MAT_DIALOG_DATA,
|
||||||
useValue: {}
|
useValue: null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
@ -13,10 +13,10 @@ describe('MotionPollDialogComponent', () => {
|
|||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [E2EImportsModule],
|
imports: [E2EImportsModule],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: MatDialogRef, useValue: {} },
|
{ provide: MatDialogRef, useValue: null },
|
||||||
{
|
{
|
||||||
provide: MAT_DIALOG_DATA,
|
provide: MAT_DIALOG_DATA,
|
||||||
useValue: {}
|
useValue: null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
@ -57,7 +57,7 @@ export class MotionPollDialogComponent extends BasePollDialogComponent<ViewMotio
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pre-executed method to initialize the dialog-form depending on the poll-method.
|
* Initialize the dialog-form depending on the poll-method.
|
||||||
*/
|
*/
|
||||||
private createDialog(): void {
|
private createDialog(): void {
|
||||||
this.dialogVoteForm = this.formBuilder.group({
|
this.dialogVoteForm = this.formBuilder.group({
|
||||||
@ -69,7 +69,7 @@ export class MotionPollDialogComponent extends BasePollDialogComponent<ViewMotio
|
|||||||
votescast: ['', [Validators.min(LOWEST_VOTE_VALUE)]]
|
votescast: ['', [Validators.min(LOWEST_VOTE_VALUE)]]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.pollData.poll) {
|
if (this.pollData && this.pollData.poll) {
|
||||||
this.updateDialogVoteForm(this.pollData);
|
this.updateDialogVoteForm(this.pollData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { OnInit } from '@angular/core';
|
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
import { MatSnackBar } from '@angular/material';
|
import { MatSnackBar } from '@angular/material';
|
||||||
import { MatDialogRef } from '@angular/material/dialog';
|
import { MatDialogRef } from '@angular/material/dialog';
|
||||||
@ -16,8 +15,7 @@ import { ViewBasePoll } from '../models/view-base-poll';
|
|||||||
/**
|
/**
|
||||||
* A dialog for updating the values of a poll.
|
* A dialog for updating the values of a poll.
|
||||||
*/
|
*/
|
||||||
export abstract class BasePollDialogComponent<T extends ViewBasePoll, S extends PollService> extends BaseViewComponent
|
export abstract class BasePollDialogComponent<T extends ViewBasePoll, S extends PollService> extends BaseViewComponent {
|
||||||
implements OnInit {
|
|
||||||
public publishImmediately: boolean;
|
public publishImmediately: boolean;
|
||||||
|
|
||||||
protected pollForm: PollFormComponent<T, S>;
|
protected pollForm: PollFormComponent<T, S>;
|
||||||
@ -31,11 +29,11 @@ export abstract class BasePollDialogComponent<T extends ViewBasePoll, S extends
|
|||||||
public dialogRef: MatDialogRef<BasePollDialogComponent<T, S>>
|
public dialogRef: MatDialogRef<BasePollDialogComponent<T, S>>
|
||||||
) {
|
) {
|
||||||
super(title, translate, matSnackbar);
|
super(title, translate, matSnackbar);
|
||||||
|
this.addKeyListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngOnInit(): void {
|
private addKeyListener(): void {
|
||||||
if (this.dialogRef) {
|
if (this.dialogRef) {
|
||||||
// Jasmin/Karma fails here. TODO:
|
|
||||||
this.dialogRef.keydownEvents().subscribe((event: KeyboardEvent) => {
|
this.dialogRef.keydownEvents().subscribe((event: KeyboardEvent) => {
|
||||||
if (event.key === 'Enter' && event.shiftKey) {
|
if (event.key === 'Enter' && event.shiftKey) {
|
||||||
this.submitPoll();
|
this.submitPoll();
|
||||||
|
Loading…
Reference in New Issue
Block a user