Skip to content
Snippets Groups Projects
Commit 9ecdb50d authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Remove useless code

parent 3eb8cc3e
Branches
Tags
No related merge requests found
......@@ -3,22 +3,22 @@
<mat-tab-group>
<mat-tab label="Text">
<div class="tab-container">
<app-content-creator [format]="'text'"></app-content-creator>
<app-content-creator [format]="'text'" [contentGroups]="contentGroups"></app-content-creator>
</div>
</mat-tab>
<mat-tab label="Single / Multiple Choice">
<div class="tab-container">
<app-content-creator [format]="'choice'"></app-content-creator>
<app-content-creator [format]="'choice'" [contentGroups]="contentGroups"></app-content-creator>
</div>
</mat-tab>
<mat-tab label="Likert">
<div class="tab-container">
<app-content-creator [format]="'likert'"></app-content-creator>
<app-content-creator [format]="'likert'" [contentGroups]="contentGroups"></app-content-creator>
</div>
</mat-tab>
<mat-tab label="{{ 'content.yes' | translate }} / {{ 'content.no' | translate }}">
<div class="tab-container">
<app-content-creator [format]="'yesno'"></app-content-creator>
<app-content-creator [format]="'yesno'" [contentGroups]="contentGroups"></app-content-creator>
</div>
</mat-tab>
</mat-tab-group>
......
import { Component, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { LanguageService } from '../../../services/util/language.service';
import { RoomService } from '../../../services/http/room.service';
import { ActivatedRoute } from '@angular/router';
import { ContentGroup } from '../../../models/content-group';
@Component({
selector: 'app-content-create-page',
......@@ -9,12 +12,28 @@ import { LanguageService } from '../../../services/util/language.service';
})
export class ContentCreatePageComponent implements OnInit {
contentGroups: ContentGroup[];
lastCollection: string;
constructor(private translateService: TranslateService,
protected langService: LanguageService) {
protected langService: LanguageService,
protected roomService: RoomService,
protected route: ActivatedRoute) {
langService.langEmitter.subscribe(lang => translateService.use(lang));
}
ngOnInit() {
this.translateService.use(sessionStorage.getItem('currentLang'));
this.route.params.subscribe(params => {
this.getGroups(params['roomId']);
});
this.lastCollection = sessionStorage.getItem('collection');
}
getGroups(id: string): void {
this.roomService.getRoomByShortId(id).subscribe(room => {
this.contentGroups = room.contentGroups;
});
}
......@@ -4,19 +4,15 @@ import { FormControl } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material';
import { ContentListComponent } from '../../shared/content-list/content-list.component';
import { Room } from '../../../models/room';
import { RoomService } from '../../../services/http/room.service';
import { ActivatedRoute } from '@angular/router';
import { ContentGroup } from '../../../models/content-group';
import { RoomPageComponent } from '../../shared/room-page/room-page.component';
import { Location } from '@angular/common';
@Component({
selector: 'app-content-creator',
templateUrl: './content-creator.component.html',
styleUrls: ['./content-creator.component.scss']
})
export class ContentCreatorComponent extends RoomPageComponent implements OnInit {
export class ContentCreatorComponent implements OnInit {
@Input() format;
@Input() contentGroups;
room: Room;
content: ContentText = new ContentText(
......@@ -28,7 +24,7 @@ export class ContentCreatorComponent extends RoomPageComponent implements OnInit
1,
[],
);
contentGroups: ContentGroup[];
lastCollection: string;
myControl = new FormControl();
......@@ -36,25 +32,10 @@ export class ContentCreatorComponent extends RoomPageComponent implements OnInit
constructor(public dialog: MatDialog,
public dialogRef: MatDialogRef<ContentListComponent>,
protected roomService: RoomService,
protected route: ActivatedRoute,
protected location: Location,
@Inject(MAT_DIALOG_DATA) public data: any) {
super(roomService, route, location);
}
ngOnInit() {
this.route.params.subscribe(params => {
this.getRoom(params['roomId']);
});
this.lastCollection = sessionStorage.getItem('collection');
}
getRoom(id: string): void {
this.roomService.getRoomByShortId(id).subscribe(room => {
this.contentGroups = room.contentGroups;
});
}
resetInputs() {
......
......@@ -35,7 +35,9 @@ export class RoomCreatorPageComponent extends RoomPageComponent implements OnIni
this.translateService.use(sessionStorage.getItem('currentLang'));
this.route.params.subscribe(params => {
this.getRoom(params['roomId']);
console.log(this.room.name);
if (this.room) {
console.log('room exists');
}
});
}
......
......@@ -65,14 +65,6 @@ export class RoomService extends BaseHttpService {
);
}
getContentGroups(id: string): Observable<ContentGroup[]> {
const connectionUrl = `${ this.apiUrl.base + this.apiUrl.rooms }/${ id }`;
return this.http.get<ContentGroup[]>(connectionUrl).pipe(
tap(() => ''),
catchError(this.handleError<ContentGroup[]>(`getContentGroup keyword=${ id }`))
);
}
getRoomByShortId(shortId: string): Observable<Room> {
const connectionUrl = `${ this.apiUrl.base + this.apiUrl.rooms }/~${ shortId }`;
return this.http.get<Room>(connectionUrl).pipe(
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment