Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
dobeybobey committed Oct 25, 2024
1 parent fcce0ed commit 869f32a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ <h5 class="modal-title">
<div class="form-group">
<label><b>Name for copied session*</b></label>
<input id="copy-session-name" type="text" class="form-control" [(ngModel)]="newFeedbackSessionName" [maxlength]="FEEDBACK_SESSION_NAME_MAX_LENGTH"
<input id="copy-session-name" type="text" class="form-control" [(ngModel)]="newFeedbackSessionName" (ngModelChange)="onNameChange()" [maxlength]="FEEDBACK_SESSION_NAME_MAX_LENGTH"
required #newSessionName="ngModel">
<div *ngIf="errorMessage" class="text-danger">
{{ errorMessage }}
</div>
<div [hidden]="newSessionName.valid || (newSessionName.pristine && newSessionName.untouched)" class="invalid-field">
<i class="fa fa-exclamation-circle" aria-hidden="true"></i>
The field "Name for copied session" should not be empty.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { Course } from '../../../types/api-output';
import { FEEDBACK_SESSION_NAME_MAX_LENGTH } from '../../../types/field-validator';

/**
* Copy current session modal.

Check warning on line 7 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Expected JSDoc block to be aligned

Check warning on line 7 in src/web/app/components/copy-session-modal/copy-session-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Expected JSDoc block to be aligned
*/
Expand All @@ -11,40 +12,32 @@ templateUrl: './copy-session-modal.component.html',
styleUrls: ['./copy-session-modal.component.scss'],
})
export class CopySessionModalComponent {

// const
FEEDBACK_SESSION_NAME_MAX_LENGTH: number = FEEDBACK_SESSION_NAME_MAX_LENGTH;

@Input()
courseCandidates: Course[] = [];

@Input()
sessionToCopyCourseId: string = '';

newFeedbackSessionName: string = '';
copyToCourseSet: Set<string> = new Set<string>();

errorMessage: string = '';

constructor(public activeModal: NgbActiveModal) {}

onNameChange(): void {
this.errorMessage = '';
}

/**
* Fires the copy event.
*/
copy(): void {
if (this.newFeedbackSessionName.trim().length === 0) {
this.errorMessage = "The field \"Name for copied session\" should not be whitespace.";
return;
}

this.errorMessage = '';

this.activeModal.close({
newFeedbackSessionName: this.newFeedbackSessionName,
sessionToCopyCourseId: this.sessionToCopyCourseId,
copyToCourseList: Array.from(this.copyToCourseSet),
});
}

/**
* Toggles selection of course to copy to in set.
*/
Expand Down

0 comments on commit 869f32a

Please sign in to comment.