forked from WISE-Community/WISE-DEPRECATED
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from WISE-Community/issue-88-refactor-similar-…
…code-component-authoring Created common parent class for editing advanced component field
- Loading branch information
Showing
7 changed files
with
38 additions
and
75 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...component-exclude-from-total-score/edit-component-exclude-from-total-score.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<mat-checkbox class="mat-primary" | ||
color="primary" | ||
[(ngModel)]="authoringComponentContent.excludeFromTotalScore" | ||
(change)="excludeFromTotalScoreChanged.next($event)" | ||
(change)="inputChanged.next($event)" | ||
i18n> | ||
Do not count score on this activity towards the total score | ||
</mat-checkbox> |
27 changes: 3 additions & 24 deletions
27
...t-component-exclude-from-total-score/edit-component-exclude-from-total-score.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,8 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { Subject, Subscription } from 'rxjs'; | ||
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; | ||
import { TeacherProjectService } from '../../../assets/wise5/services/teacherProjectService'; | ||
import { Component } from '@angular/core'; | ||
import { EditComponentFieldComponent } from '../edit-component-field.component'; | ||
|
||
@Component({ | ||
selector: 'edit-component-exclude-from-total-score', | ||
templateUrl: 'edit-component-exclude-from-total-score.component.html' | ||
}) | ||
export class EditComponentExcludeFromTotalScoreComponent { | ||
@Input() | ||
authoringComponentContent: any; | ||
excludeFromTotalScoreChanged: Subject<string> = new Subject<string>(); | ||
excludeFromTotalScoreChangedSubscription: Subscription; | ||
|
||
constructor(private ProjectService: TeacherProjectService) {} | ||
|
||
ngOnInit() { | ||
this.excludeFromTotalScoreChangedSubscription = this.excludeFromTotalScoreChanged | ||
.pipe(debounceTime(1000), distinctUntilChanged()) | ||
.subscribe(() => { | ||
this.ProjectService.componentChanged(); | ||
}); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.excludeFromTotalScoreChangedSubscription.unsubscribe(); | ||
} | ||
} | ||
export class EditComponentExcludeFromTotalScoreComponent extends EditComponentFieldComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Directive, Input } from '@angular/core'; | ||
import { Subject, Subscription } from 'rxjs'; | ||
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; | ||
import { TeacherProjectService } from '../../assets/wise5/services/teacherProjectService'; | ||
|
||
@Directive() | ||
export abstract class EditComponentFieldComponent { | ||
@Input() | ||
authoringComponentContent: any; | ||
inputChanged: Subject<string> = new Subject<string>(); | ||
inputChangedSubscription: Subscription; | ||
|
||
constructor(private ProjectService: TeacherProjectService) {} | ||
|
||
ngOnInit() { | ||
this.inputChangedSubscription = this.inputChanged | ||
.pipe(debounceTime(1000), distinctUntilChanged()) | ||
.subscribe(() => { | ||
this.ProjectService.componentChanged(); | ||
}); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.inputChangedSubscription.unsubscribe(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 3 additions & 24 deletions
27
src/app/authoring-tool/edit-component-max-score/edit-component-max-score.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,8 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { Subject, Subscription } from 'rxjs'; | ||
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; | ||
import { TeacherProjectService } from '../../../assets/wise5/services/teacherProjectService'; | ||
import { Component } from '@angular/core'; | ||
import { EditComponentFieldComponent } from '../edit-component-field.component'; | ||
|
||
@Component({ | ||
selector: 'edit-component-max-score', | ||
templateUrl: 'edit-component-max-score.component.html' | ||
}) | ||
export class EditComponentMaxScoreComponent { | ||
@Input() | ||
authoringComponentContent: any; | ||
maxScoreChanged: Subject<string> = new Subject<string>(); | ||
maxScoreChangedSubscription: Subscription; | ||
|
||
constructor(private ProjectService: TeacherProjectService) {} | ||
|
||
ngOnInit() { | ||
this.maxScoreChangedSubscription = this.maxScoreChanged | ||
.pipe(debounceTime(1000), distinctUntilChanged()) | ||
.subscribe(() => { | ||
this.ProjectService.componentChanged(); | ||
}); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.maxScoreChangedSubscription.unsubscribe(); | ||
} | ||
} | ||
export class EditComponentMaxScoreComponent extends EditComponentFieldComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 3 additions & 24 deletions
27
src/app/authoring-tool/edit-component-width/edit-component-width.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,8 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { Subject, Subscription } from 'rxjs'; | ||
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; | ||
import { TeacherProjectService } from '../../../assets/wise5/services/teacherProjectService'; | ||
import { Component } from '@angular/core'; | ||
import { EditComponentFieldComponent } from '../edit-component-field.component'; | ||
|
||
@Component({ | ||
selector: 'edit-component-width', | ||
templateUrl: 'edit-component-width.component.html' | ||
}) | ||
export class EditComponentWidthComponent { | ||
@Input() | ||
authoringComponentContent: any; | ||
widthChanged: Subject<string> = new Subject<string>(); | ||
widthChangedSubscription: Subscription; | ||
|
||
constructor(private ProjectService: TeacherProjectService) {} | ||
|
||
ngOnInit() { | ||
this.widthChangedSubscription = this.widthChanged | ||
.pipe(debounceTime(1000), distinctUntilChanged()) | ||
.subscribe(() => { | ||
this.ProjectService.componentChanged(); | ||
}); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.widthChangedSubscription.unsubscribe(); | ||
} | ||
} | ||
export class EditComponentWidthComponent extends EditComponentFieldComponent {} |