Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #220602 feat: MTF Question in QuML Editor #1

Merged
merged 54 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
44f548c
Issue #42 feat: Added an interface for match the following type question
Jul 13, 2023
cefe2a6
Used optional chaining
Jul 14, 2023
0cc5c50
updated answer type to string as per schema
Jul 15, 2023
803e876
Add Match The Following Question in question primary categories
Jul 21, 2023
fff1095
Added Match The Following Question
Jul 21, 2023
f93a373
Issue #42 feat: Function for preparing Match the following body
Jul 21, 2023
fd99b99
Added some button labels
Jul 21, 2023
c0e88fd
Issue #42 feat: Added support if questionInteraction type is match
Jul 22, 2023
ea38850
Issue #42 feat: Modifications in metadata of Match The Following Type…
Jul 24, 2023
35aa70e
Issue #42 feat: body and answer body in the form of HTML
Jul 24, 2023
90f8830
Merge branch 'match-metadata-question' into C4GT_Issue_42
Jul 25, 2023
862b86d
test foreditorDataHandler()
Jul 25, 2023
296a025
modifiedtest for setMapping when interaction type is choice
Jul 25, 2023
8b8dead
Issue #42 feat: new match component added
Aug 1, 2023
b14cda9
Adding match component in question template
Aug 1, 2023
2c982fd
Adding match component in module
Aug 1, 2023
1ea5d7c
Revert "test foreditorDataHandler()"
Aug 1, 2023
c233eae
Revert "modifiedtest for setMapping when interaction type is choice"
Aug 1, 2023
23ddf3a
Reverting option component file
Aug 1, 2023
000c5c3
Refactoring of code in match component and question component
Aug 1, 2023
c19a96e
Tests for match component
Aug 1, 2023
f82c884
Issue #42 feat: New Match Type Question Implementation
Aug 7, 2023
1cda982
Added interfaces in sonar exclusion
Aug 8, 2023
d068f4f
Added tests for new functions in question component
Aug 9, 2023
01707b2
Mock data for tests
Aug 9, 2023
52f53ec
Refactored getQuestionMetadata function
Aug 9, 2023
dba6334
UI refactored and tests added
Aug 10, 2023
957cb3d
Bug resolved
Aug 10, 2023
a0bc2dc
Merge pull request #97 from gupta-arpan/release-6.1.0
sajeshkayyath Aug 11, 2023
2c8faa2
Merge branch 'C4GT_Issue_42' into new-match-component
Aug 11, 2023
73eb19d
Refactored question component code and tests added
Aug 11, 2023
4ff8fca
Code refactored
Aug 16, 2023
f3ddc5b
Match template refactored
Aug 17, 2023
cd046e4
Question component refactored
Aug 17, 2023
5cbf70c
Refactored Code
Aug 18, 2023
e3a7038
Canaged correctMatchPair property in metadata
Aug 19, 2023
7eb285a
Resolved fill this option error bug
Aug 23, 2023
54a0c9d
Merged release-6.2.0 branch
Sep 5, 2023
a60bf40
Updated package-lock.json file after merge
Sep 5, 2023
a7ecb41
Update PR
Sep 5, 2023
28dcfdb
Revert "Updated package-lock.json file after merge"
Sep 5, 2023
045b6ca
Merge pull request #106 from gupta-arpan/release-6.2.0
rajnishdargan Sep 5, 2023
ec8e873
Merge branch 'C4GT_Issue_42' of https://github.com/Sunbird-inQuiry/ed…
Sep 5, 2023
704fa70
skipped some test cases
Sep 5, 2023
897d312
Merge pull request #92 from gupta-arpan/new-match-component
rajnishdargan Sep 6, 2023
79f8b27
Merge remote-tracking branch 'upstream/C4GT_Issue_42' into mtf-dev
rajnishdargan Jun 4, 2024
f2d1c1b
Issue #220602 feat: MTF Question in QuML Editor
rajnishdargan Jun 5, 2024
c1e9487
Issue #220602 feat: MTF Question in QuML Editor
rajnishdargan Jun 10, 2024
631b86f
Issue #220602 feat: Design review adjustments
rajnishdargan Jul 4, 2024
05b3b58
Issue #220602 feat: UI improvement
rajnishdargan Jul 5, 2024
116c00d
Issue #221304 feat: UI improvement
rajnishdargan Jul 8, 2024
0e69d65
Issue #221304 feat: Fix test cases
rajnishdargan Jul 8, 2024
7336adf
Issue #220602 feat: MTF Question in QuML Editor
rajnishdargan Aug 5, 2024
29ebbd5
Issue #220602 feat: Building web component and updating package versions
rajnishdargan Aug 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions projects/questionset-editor-library-wc/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
@import "./../../questionset-editor-library/src/lib/components/slider/slider.component.scss";
@import "./../../questionset-editor-library/src/lib/components/template/template.component.scss";
@import "./../../questionset-editor-library/src/lib/components/translations/translations.component.scss";
@import "./../../questionset-editor-library/src/lib/components/match/match.component.scss";

2 changes: 1 addition & 1 deletion projects/questionset-editor-library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tekdi/sunbird-questionset-editor",
"version": "8.0.0",
"version": "9.0.0-beta.0",
"dependencies": {
"tslib": "^2.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="editorWrapper" [ngClass]="{'hasError': limitExceeded}">
<button type="button" data-tooltip="Add image" data-position="bottom center" data-variation="mini" data-inverted=""
<button *ngIf="imageIconPosition === 'default'" type="button" data-tooltip="Add image" data-position="bottom center" data-variation="mini" data-inverted=""
title="Add image" [disabled]="isAssetBrowserReadOnly || isEditorFocused" (click)="initializeImagePicker('question')"
class="ui icon button insert-image-btn">
<i class="image outline icon" aria-hidden="true"></i>
Expand All @@ -9,6 +9,13 @@
<div class="characterCount">
{{configService.labelConfig?.lbl?.charactersLeft}} {{charactersLeft}}
</div>
<div *ngIf="imageIconPosition === 'bottom'">
<button type="button" data-tooltip="Add image" data-position="bottom center"
data-variation="mini" data-inverted="" title="Add image" [disabled]="isAssetBrowserReadOnly || isEditorFocused"
(click)="initializeImagePicker('question')" class="ui icon button bottomImage">
<i class="image outline icon" aria-hidden="true"></i>
</button>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
font-size: 11px;
font-weight: bold;
margin-top: -16px;
position: relative
position: relative;
}

.bottomImage {
background-color: transparent;
z-index: 1;
font-size: 12px;
float:right;
}

.custom-image img {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class CkeditorToolComponent implements OnInit, AfterViewInit, OnChanges {
@Output() videoDataOutput = new EventEmitter<any>();
@Input() videoShow;
@Input() setCharacterLimit: number;
@Input() imageIconPosition = 'default';
@Input() setImageLimit: any;
public editorConfig: any;
public imageUploadLoader = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<ng-container *ngIf="!isReadOnlyMode">
<div class="pt-10 fs-0-92 sb-w-85">
<label class="fs-0-92 font-weight-bold">
{{configService.labelConfig?.lbl?.setAnswers}}
<span class="sb-required">*</span>
</label>
<label class="fs-0-92 d-inline-block">
{{configService.labelConfig?.lbl?.selectLayout}}
</label>
<i class="icon info circle ml-8" suiPopup popupDelay="500"
popupText={{configService.labelConfig?.lbl?.optionsPopupText}}></i>
<span class="divider mr-8"></span>
<span>
<button class="sb-btn sb-btn-xs sb-btn-outline-gray mr-5 q-sb-layout-two"
[ngClass]="{active: 'mtf-vertical' === templateType}" (click)="setTemplate('mtf-vertical')">
<i class="mr-10 h-7 w-20"></i>
{{configService.labelConfig?.lbl?.vertical}}
</button>
</span>
<span>
<button class="sb-btn sb-btn-xs sb-btn-outline-gray mr-5 q-sb-layout-single"
[ngClass]="{active: 'mtf-horizontal' === templateType}" (click)="setTemplate('mtf-horizontal')">
<i class="mr-10 h-7"></i>
{{configService.labelConfig?.lbl?.horizontal}}
</button>
</span>
</div>
<div class="d-flex pt-10 flex-dc sb-mcq-form">
<div class="d-flex flex-w-wrap" *ngFor="let option of editorState.options; let i = index">
<div class="w-100 mb-24">
<div class="d-flex flex-w-wrap flex-jc-space-between w-100">
<div class="w-49">
<lib-ckeditor-tool [setCharacterLimit]="setCharacterLimit"
(editorDataOutput)="option.left = $event.body; option.leftLength = $event.length; editorDataHandler($event);"
[editorDataInput]="option.left" class="ckeditor-tool__option mb-10" [imageIconPosition]="'bottom'"
[class.mb-5]="showFormError && ([undefined, ''].includes(option.left.body) || option.left.length > setCharacterLimit)">
</lib-ckeditor-tool>
<label class="ui basic red error label pt-1" *ngIf="option.leftLength > setCharacterLimit">
{{configService.labelConfig?.lbl?.reduceSize}}
</label>
<label class="sb-color-error fs-0-785"
*ngIf="showFormError && (option.left === undefined || option.left === '')">
{{configService.labelConfig?.lbl?.fillThisOption}}
</label>
</div>
<div class="w-49">
<lib-ckeditor-tool [setCharacterLimit]="setCharacterLimit"
(editorDataOutput)="option.right = $event.body; option.rightLength = $event.length; editorDataHandler($event);"
[editorDataInput]="option.right" class="ckeditor-tool__option mb-10" [imageIconPosition]="'bottom'"
[class.mb-5]="showFormError && ([undefined, ''].includes(option.right.body) || option.right.length > setCharacterLimit)">
</lib-ckeditor-tool>
<label class="ui basic red error label pt-1" *ngIf="option.rightLength > setCharacterLimit">
{{configService.labelConfig?.lbl?.reduceSize}}
</label>
<label class="sb-color-error fs-0-785"
*ngIf="showFormError && (option.right === undefined || option.right === '')">
{{configService.labelConfig?.lbl?.fillThisOption}}
</label>
</div>
</div>
<div>
<button class="sb-btn sb-btn-xs sb-left-icon-btn text-inherit b-0 bg-none no-hover p-0 mb-10 mt-10 right"
[disabled]="editorState.options.length < 3"
(click)="editorState.deleteOptions(i);editorDataHandler($event);" libTelemetryInteract
[telemetryInteractEdata]="telemetryService.getTelemetryInteractEdata('delete_option','click','submit',telemetryService.telemetryPageId)">
<i class="icon trash outline fs-1-286 pull-left mr-0"></i>
<span class="sb-line-height-24">{{configService.labelConfig?.button_labels?.delete_pair_btn_label}}</span>
</button>
</div>
</div>
</div>
<div class="d-flex">
<button *ngIf="editorState.options.length < editorState.maximumOptions"
class="sb-btn sb-btn-outline-primary sb-btn-xs sb-left-icon-btn text-inherit b-0 bg-none no-hover p-0 mb-10 mt-10"
(click)="editorState.addOptions();editorDataHandler($event);" libTelemetryInteract
[telemetryInteractEdata]="telemetryService.getTelemetryInteractEdata('add_option','click','submit',telemetryService.telemetryPageId)">
<i class="plus circle icon fs-1-286 pull-left mr-0" aria-hidden="true"></i>
<span class="sb-line-height-24">{{configService.labelConfig?.lbl?.addPair}}</span>
</button>
</div>
</div>
</ng-container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.q-sb-layout-single{
&:before{
content: url("/assets/images/layoutoneicon.svg");
}
&.active,
&:hover
{
border-color: var(--primary-400);
background-color: #ffffff;
color: var(--primary-400);
&:before{
content: url("/assets/images/layoutoneicon_blue.svg");
}
}
}
.q-sb-layout-two{
&:before{
content: url("/assets/images/layouttwoicon.svg");
}
&.active,
&:hover
{
border-color: var(--primary-400);
background-color: #ffffff;
color: var(--primary-400);
&:before{
content: url("/assets/images/layouttwoicon_blue.svg");
}
}
}

.b-0{
border: 0 !important;
}

.bg-none{
background-color: transparent !important;

&:hover,
&:focus {
background-color: transparent !important;
}
}

.w-49{
width: 49%;
max-width: 49%;
}

.sb-line-height-24 {
line-height: 24px;
}

.right{
float: right;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
export const mockOptionData = {
editorOptionData: {
question: "<p>Match the pairs?</p>",
options: [
{
left: "<p>2</p>",
right: "<p>even</p>",
},
{
left: "<p>3</p>",
right: "<p>odd</p>",
},
],
templateId: "mtf-vertical",
correctMatchPair: [
{
"left": 0,
"right": [0]
},
{
"left": 1,
"right": [1]
}
],
numberOfOptions: 4,
},
prepareMtfBody: {
templateId: "mtf-horizontal",
name: "Match The Following Question",
responseDeclaration: {
"response1": {
"cardinality": "ordered",
"type": "map",
"correctResponse": {
"value": [
{
"left": 0,
"right": [0]
},
{
"left": 1,
"right": [1]
}
]
},
"mapping": [
{
"value": {
"left": 0,
"right": 0
},
"score": 0.5
},
{
"value": {
"left": 1,
"right": 1
},
"score": 0.5
}
]
}
},
interactionTypes: ["match"],
interactions: {
"response1": {
"type": "match",
"options": {
"left": [
{
"label": "<p>2</p>",
"value": 0
},
{
"label": "<p>3</p>",
"value": 1
}
],
"right": [
{
"label": "<p>even</p>",
"value": 0
},
{
"label": "<p>odd</p>",
"value": 1
}
]
},
"validation": {
"required": "Yes"
}
}
},
editorState: {
"options": {
"left": [
{
"value": {
"body": "<p>2</p>",
"value": 0
}
},
{
"value": {
"body": "<p>3</p>",
"value": 1
}
}
],
"right": [
{
"value": {
"body": "<p>even</p>",
"value": 0
}
},
{
"value": {
"body": "<p>odd</p>",
"value": 1
}
}
]
},
"question": "<p>Match the pairs</p>"
},
qType: "MTF",
primaryCategory: "Match The Following Question",
},
};
Loading