Skip to content

Commit

Permalink
[#12081] Modify question headers for instructor (#12228)
Browse files Browse the repository at this point in the history
* Modify question headers in instructor edit sessions page

* Fix tests

* Fix e2e tests
  • Loading branch information
jasonqiu212 authored and zhaojj2209 committed Mar 25, 2023
1 parent 17a72d1 commit 4bba773
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -972,8 +972,7 @@ private WebElement getQuestionForm(int questionNum) {
}

private FeedbackQuestionType getQuestionType(int questionNum) {
String questionDetails = getQuestionForm(questionNum).findElement(By.id("question-header")).getText();
String questionType = questionDetails.split(" \\d+ ")[1].trim();
String questionType = getQuestionForm(questionNum).findElement(By.id("question-type")).getText().trim();

switch (questionType) {
case "Essay question":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ exports[`QuestionEditFormComponent should snap with default view 1`] = `
class="card"
id="question-form-0"
>
<div
class="card-header bg-primary text-white cursor-pointer"
<button
class="card-header bg-primary text-white cursor-pointer border-0"
>
<div
class="collapse-caret"
Expand All @@ -49,17 +49,28 @@ exports[`QuestionEditFormComponent should snap with default view 1`] = `
</tm-panel-chevron>
</div>
<div
class="d-flex flex-column text-start"
id="question-header"
>
<strong>
Question
<div
class="d-flex flex-sm-row flex-column align-items-sm-center align-items-start"
>
<h2
class="question-number fw-bold me-1"
>
Question
<span
id="question-number"
>
0
</span>
</h2>
<span
id="question-number"
id="question-type"
>
0
Essay question
</span>
</strong>
Essay question
</div>
</div>
<div
class="card-header-btn-toolbar"
Expand Down Expand Up @@ -99,7 +110,7 @@ exports[`QuestionEditFormComponent should snap with default view 1`] = `
</button>
</div>
</div>
</div>
</button>
<div
class="ng-trigger ng-trigger-collapseAnim"
style=""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<div id="question-form-{{ model.questionNumber }}" class="card">
<div class="card-header bg-primary text-white cursor-pointer" (click)="triggerModelChange('isCollapsed', !model.isCollapsed)">
<button class="card-header bg-primary text-white cursor-pointer border-0" (click)="triggerModelChange('isCollapsed', !model.isCollapsed)">
<div class="collapse-caret">
<tm-panel-chevron [isExpanded]="!model.isCollapsed"></tm-panel-chevron>
</div>
<div id="question-header">
<strong>Question <span id="question-number" *ngIf="!model.isEditable">{{ model.questionNumber }}</span></strong>
<select id="question-number-dropdown" class="form-control form-select question-number-select" [ngModel]="model.questionNumber" (ngModelChange)="triggerModelChange('questionNumber', $event)" *ngIf="model.isEditable" (click)="$event.stopPropagation()">
<option *ngFor="let i of range(numOfQuestions)" [ngValue]="i + 1">{{ i + 1 }}</option>
</select>
{{ model.questionType | questionTypeName }}
<div id="question-header" class="d-flex flex-column text-start">
<div class="d-flex flex-sm-row flex-column align-items-sm-center align-items-start">
<h2 class="question-number fw-bold me-1">Question <span id="question-number" *ngIf="!model.isEditable">{{ model.questionNumber }}</span>
<select id="question-number-dropdown" class="form-control form-select question-number-select" [ngModel]="model.questionNumber" (ngModelChange)="triggerModelChange('questionNumber', $event)" *ngIf="model.isEditable" (click)="$event.stopPropagation()">
<option *ngFor="let i of range(numOfQuestions)" [ngValue]="i + 1">{{ i + 1 }}</option>
</select>
</h2>
<span id="question-type">{{ model.questionType | questionTypeName }}</span>
</div>
<ng-container *ngIf="model.isCollapsed">
<br>
<div class="collapse-qn-description">{{ model.questionBrief }}</div>
</ng-container>
</div>
Expand Down Expand Up @@ -53,7 +55,7 @@
</button>
</div>
</div>
</div>
</button>
<div *ngIf="!model.isCollapsed" @collapseAnim>
<div class="card-body">
<div class="background-color-light-blue">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
margin-right: 5px;
}

.question-number {
font-size: .875rem;
margin-bottom: 0;
}

.background-color-light-blue {
background-color: #EAEFF5;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="margin-top-15px padding-15px" [ngClass]="{ 'background-color-light-green': !model.isQuestionHasResponses, 'alert alert-danger': model.isQuestionHasResponses }">
<div>
<div *ngIf="model.isQuestionHasResponses">
<h5>Changing the visibility after collecting responses is not recommended.</h5>
<p class="fs-6 fw-bold">Changing the visibility after collecting responses is not recommended.</p>
<p>Reason: The existing responses were submitted under the 'promise' of a certain visibility and changing the visibility later 'breaks' that promise.</p>
</div>
<b [ngClass]="{ 'visibility-title': !model.isQuestionHasResponses }">Visibility</b> (Who can see the responses?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1280,8 +1280,8 @@ exports[`InstructorSessionEditPageComponent should snap with feedback session qu
class="card"
id="question-form-1"
>
<div
class="card-header bg-primary text-white cursor-pointer"
<button
class="card-header bg-primary text-white cursor-pointer border-0"
>
<div
class="collapse-caret"
Expand All @@ -1297,27 +1297,38 @@ exports[`InstructorSessionEditPageComponent should snap with feedback session qu
</tm-panel-chevron>
</div>
<div
class="d-flex flex-column text-start"
id="question-header"
>
<strong>
Question
</strong>
<select
class="form-control form-select question-number-select ng-untouched ng-pristine ng-valid"
id="question-number-dropdown"
<div
class="d-flex flex-sm-row flex-column align-items-sm-center align-items-start"
>
<option
value="0: 1"
<h2
class="question-number fw-bold me-1"
>
1
</option>
<option
value="1: 2"
Question
<select
class="form-control form-select question-number-select ng-untouched ng-pristine ng-valid"
id="question-number-dropdown"
>
<option
value="0: 1"
>
1
</option>
<option
value="1: 2"
>
2
</option>
</select>
</h2>
<span
id="question-type"
>
2
</option>
</select>
Essay question
Essay question
</span>
</div>
</div>
<div
class="card-header-btn-toolbar"
Expand Down Expand Up @@ -1366,7 +1377,7 @@ exports[`InstructorSessionEditPageComponent should snap with feedback session qu
</button>
</div>
</div>
</div>
</button>
<div
class="ng-trigger ng-trigger-collapseAnim ng-animating"
style=""
Expand Down Expand Up @@ -1988,8 +1999,8 @@ exports[`InstructorSessionEditPageComponent should snap with feedback session qu
class="card"
id="question-form-2"
>
<div
class="card-header bg-primary text-white cursor-pointer"
<button
class="card-header bg-primary text-white cursor-pointer border-0"
>
<div
class="collapse-caret"
Expand All @@ -2005,27 +2016,38 @@ exports[`InstructorSessionEditPageComponent should snap with feedback session qu
</tm-panel-chevron>
</div>
<div
class="d-flex flex-column text-start"
id="question-header"
>
<strong>
Question
</strong>
<select
class="form-control form-select question-number-select ng-untouched ng-pristine ng-valid"
id="question-number-dropdown"
<div
class="d-flex flex-sm-row flex-column align-items-sm-center align-items-start"
>
<option
value="0: 1"
<h2
class="question-number fw-bold me-1"
>
1
</option>
<option
value="1: 2"
Question
<select
class="form-control form-select question-number-select ng-untouched ng-pristine ng-valid"
id="question-number-dropdown"
>
<option
value="0: 1"
>
1
</option>
<option
value="1: 2"
>
2
</option>
</select>
</h2>
<span
id="question-type"
>
2
</option>
</select>
Essay question
Essay question
</span>
</div>
</div>
<div
class="card-header-btn-toolbar"
Expand Down Expand Up @@ -2074,7 +2096,7 @@ exports[`InstructorSessionEditPageComponent should snap with feedback session qu
</button>
</div>
</div>
</div>
</button>
<div
class="ng-trigger ng-trigger-collapseAnim ng-animating"
style=""
Expand Down Expand Up @@ -3886,8 +3908,8 @@ exports[`InstructorSessionEditPageComponent should snap with new question added
class="card"
id="question-form-0"
>
<div
class="card-header bg-primary text-white cursor-pointer"
<button
class="card-header bg-primary text-white cursor-pointer border-0"
>
<div
class="collapse-caret"
Expand All @@ -3903,22 +3925,33 @@ exports[`InstructorSessionEditPageComponent should snap with new question added
</tm-panel-chevron>
</div>
<div
class="d-flex flex-column text-start"
id="question-header"
>
<strong>
Question
</strong>
<select
class="form-control form-select question-number-select ng-untouched ng-pristine ng-valid"
id="question-number-dropdown"
<div
class="d-flex flex-sm-row flex-column align-items-sm-center align-items-start"
>
<option
value="0: 1"
<h2
class="question-number fw-bold me-1"
>
1
</option>
</select>
Essay question
Question
<select
class="form-control form-select question-number-select ng-untouched ng-pristine ng-valid"
id="question-number-dropdown"
>
<option
value="0: 1"
>
1
</option>
</select>
</h2>
<span
id="question-type"
>
Essay question
</span>
</div>
</div>
<div
class="card-header-btn-toolbar"
Expand All @@ -3935,7 +3968,7 @@ exports[`InstructorSessionEditPageComponent should snap with new question added
</button>
</div>
</div>
</div>
</button>
<div
class="ng-trigger ng-trigger-collapseAnim ng-animating"
style=""
Expand Down

0 comments on commit 4bba773

Please sign in to comment.