diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3d7a3b456089fc7fd8b9b2f5ae3d81616f72385c..33af09b4b51f051d315de5d133d8d12a46e80ab6 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -146,7 +146,6 @@ export function dialogClose(dialogResult: any) { FooterComponent, FooterLoginDialogComponent, FooterImprintComponent, - CollectionSelectComponent, ], entryComponents: [ RegisterComponent, @@ -163,8 +162,7 @@ export function dialogClose(dialogResult: any) { ContentDeleteComponent, MarkdownHelpDialogComponent, GenericDataDialogComponent, - FooterLoginDialogComponent, - CollectionSelectComponent, + FooterLoginDialogComponent ], imports: [ AppRoutingModule, diff --git a/src/app/components/dialogs/collection-select-component/collection-select-component.component.html b/src/app/components/dialogs/collection-select-component/collection-select-component.component.html deleted file mode 100644 index 8eb205d142af9c1deef206b3b1e66692ae232488..0000000000000000000000000000000000000000 --- a/src/app/components/dialogs/collection-select-component/collection-select-component.component.html +++ /dev/null @@ -1,3 +0,0 @@ -<p> - collection-select-component works! -</p> diff --git a/src/app/components/dialogs/collection-select-component/collection-select-component.component.scss b/src/app/components/dialogs/collection-select-component/collection-select-component.component.scss deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/app/components/dialogs/collection-select-component/collection-select-component.component.spec.ts b/src/app/components/dialogs/collection-select-component/collection-select-component.component.spec.ts deleted file mode 100644 index 763f10321f275597f304653d9815bd4885025673..0000000000000000000000000000000000000000 --- a/src/app/components/dialogs/collection-select-component/collection-select-component.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CollectionSelectComponentComponent } from './collection-select-component.component'; - -describe('CollectionSelectComponentComponent', () => { - let component: CollectionSelectComponentComponent; - let fixture: ComponentFixture<CollectionSelectComponentComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CollectionSelectComponentComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CollectionSelectComponentComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/components/dialogs/collection-select-component/collection-select-component.component.ts b/src/app/components/dialogs/collection-select-component/collection-select-component.component.ts deleted file mode 100644 index 570dc1caab270f0f206c2b952abbdc7b1622d488..0000000000000000000000000000000000000000 --- a/src/app/components/dialogs/collection-select-component/collection-select-component.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-collection-select-component', - templateUrl: './collection-select-component.component.html', - styleUrls: ['./collection-select-component.component.scss'] -}) -export class CollectionSelectComponentComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/src/app/components/dialogs/collection-select/collection-select.component.html b/src/app/components/dialogs/collection-select/collection-select.component.html deleted file mode 100644 index e0cc61ffbe5abb0be8393fb0e103e5ee18d40047..0000000000000000000000000000000000000000 --- a/src/app/components/dialogs/collection-select/collection-select.component.html +++ /dev/null @@ -1,19 +0,0 @@ -<form> - <div fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px"> - <h3> - Please select a collection or enter a new one! - </h3> - <mat-form-field> - <input type="text" matInput [formControl]="myControl" [matAutocomplete]="auto" - placeholder="Collection name"/> - <mat-autocomplete #auto="matAutocomplete"> - <mat-option *ngFor="let collection of filteredOptions | async" [value]="collection"> - {{collection}} - </mat-option> - </mat-autocomplete> - </mat-form-field> - <button mat-raised-button color="primary" (click)="onNoClick()"> - Done - </button> - </div> -</form> diff --git a/src/app/components/dialogs/collection-select/collection-select.component.scss b/src/app/components/dialogs/collection-select/collection-select.component.scss deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/app/components/dialogs/collection-select/collection-select.component.spec.ts b/src/app/components/dialogs/collection-select/collection-select.component.spec.ts deleted file mode 100644 index cc4ea9286fde12ea1ae9da215dcffcb5ee4fb584..0000000000000000000000000000000000000000 --- a/src/app/components/dialogs/collection-select/collection-select.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CollectionSelectComponent } from './collection-select.component'; - -describe('CollectionSelectComponent', () => { - let component: CollectionSelectComponent; - let fixture: ComponentFixture<CollectionSelectComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CollectionSelectComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CollectionSelectComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/components/dialogs/collection-select/collection-select.component.ts b/src/app/components/dialogs/collection-select/collection-select.component.ts deleted file mode 100644 index 5c93d438919dc9a21c7529f2d07034c68a3ad868..0000000000000000000000000000000000000000 --- a/src/app/components/dialogs/collection-select/collection-select.component.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { Component, Inject, OnInit } from '@angular/core'; -import { RoomService } from '../../../services/http/room.service'; -import { Room } from '../../../models/room'; -import { Router } from '@angular/router'; -import { NotificationService } from '../../../services/util/notification.service'; -import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; -import { FormControl } from '@angular/forms'; -import { map, startWith } from 'rxjs/operators'; -import { Observable } from 'rxjs'; -import { ContentText } from '../../../models/content-text'; -import { ContentService } from '../../../services/http/content.service'; - -@Component({ - selector: 'app-collection-select', - templateUrl: './collection-select.component.html', - styleUrls: ['./collection-select.component.scss'] -}) -export class CollectionSelectComponent implements OnInit { - - name: string; - room: Room; - content: ContentText; - roomId: string; - collections: string[] = ['ARSnova', 'Angular', 'HTML', 'TypeScript' ]; - myControl = new FormControl(); - filteredOptions: Observable<string[]>; - - constructor(private roomService: RoomService, - private contentService: ContentService, - private router: Router, - private notificationService: NotificationService, - public dialogRef: MatDialogRef<CollectionSelectComponent>, - @Inject(MAT_DIALOG_DATA) public data: any) { - } - - onNoClick(): void { - this.dialogRef.close(); - } - - ngOnInit() { - this.filteredOptions = this.myControl.valueChanges - .pipe( - startWith(''), - map(value => this._filter(value)) - ); - } - - - private _filter(value: string): string[] { - const filterValue = value.toLowerCase(); - - return this.collections.filter(collection => collection.toLowerCase().includes(filterValue)); - } - - resetAfterSubmit() { - this.content.subject = ''; - this.content.body = ''; - this.notificationService.show('Content submitted. Ready for creation of new content.'); - } - - submitContent(subject: string, body: string) { - this.contentService.addContent(new ContentText( - '1', - '1', - this.roomId, - subject, - body, - 1, - [], - )).subscribe(); - if (this.content.body.valueOf() === '' || this.content.body.valueOf() === '') { - this.notificationService.show('No empty fields allowed. Please check subject and body.'); - return; - } - this.notificationService.show('Content submitted.'); - this.resetAfterSubmit(); - } -} diff --git a/src/app/components/fragments/content-list/content-list.component.ts b/src/app/components/fragments/content-list/content-list.component.ts index f30699b9115d4a4068fd6f8aafbce2e7e6aa2aea..62806aa2d78cf80119376ffeade61aad174cb783 100644 --- a/src/app/components/fragments/content-list/content-list.component.ts +++ b/src/app/components/fragments/content-list/content-list.component.ts @@ -176,7 +176,7 @@ export class ContentListComponent implements OnInit { } else { if (action.valueOf() === 'delete') { this.notificationService.show('Content "' + this.contents[index].subject + '" deleted.'); - this.contentService.deleteContent(this.contents[index].contentId); + this.contentService.deleteContent(this.contents[index].id); this.contents.splice(index, 1); } if (action.valueOf() === 'edit') {