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 3cc27ac commit 2ce4800
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h5 class="modal-title">
<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"
required #newSessionName="ngModel">
<div [hidden]="validateName(newSessionName.value)" class="invalid-field">
<div [hidden]="(validName)" class="invalid-field">
<i class="fa fa-exclamation-circle" aria-hidden="true"></i>
The field "Name for copied session" should not be empty.
</div>
Expand All @@ -35,5 +35,5 @@ <h5 class="modal-title">
<div class="modal-footer">
<button type="button" class="btn btn-light" (click)="activeModal.dismiss()">Cancel</button>
<button id="btn-confirm-copy-course" type="button" class="btn btn-primary" (click)="copy()"
[disabled]="!newFeedbackSessionName || copyToCourseSet.size < 1 || !validateName(newSessionName.value)">Copy</button>
[disabled]="!newFeedbackSessionName || copyToCourseSet.size < 1 || !(validName)">Copy</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,21 @@ export class CopySessionModalComponent {
/**
* boolean to store validity of name
* /
validName: boolean = false;
validateName(sessionName: string): boolean {
if (this.sessionName.trim().length==0) {
return false;
}
else {
return true;
}
}
/**
* Fires the copy event.
*/
copy(): void {
/**
* check if session name is whitespace or not
*/
if (validateName(this.newFeedbackSessionName)) {
* check if session name is whitespace or not
* /
if (this.newFeedbackSessionName.trim().length==0) {
this.validName = false;
return;
} else {
this.validName = true;
this.activeModal.close({
newFeedbackSessionName: this.newFeedbackSessionName,
sessionToCopyCourseId: this.sessionToCopyCourseId,
Expand Down

0 comments on commit 2ce4800

Please sign in to comment.