Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
zesje
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Works on my machine
zesje
Commits
65813440
Commit
65813440
authored
5 years ago
by
jtimotei
Browse files
Options
Downloads
Patches
Plain Diff
Added some comments and solved a small issue
parent
72975664
No related branches found
Branches containing commit
No related tags found
1 merge request
!14
Add boxes frontend
Pipeline
#17734
passed
5 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/components/PaneMCQ.jsx
+15
-0
15 additions, 0 deletions
client/components/PaneMCQ.jsx
client/views/ExamEditor.jsx
+1
-1
1 addition, 1 deletion
client/views/ExamEditor.jsx
with
16 additions
and
1 deletion
client/components/PaneMCQ.jsx
+
15
−
0
View file @
65813440
import
React
from
'
react
'
/**
* PanelMCQ is a component that allows the user to generate mcq options
*/
class
PanelMCQ
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
)
...
...
@@ -12,6 +15,8 @@ class PanelMCQ extends React.Component {
labelTypes
:
[
'
None
'
,
'
True/False
'
,
'
A, B, C ...
'
,
'
1, 2, 3 ...
'
]
}
}
// this function is called when the input is changed for the number of possible answers
onChangeNPA
(
e
)
{
let
value
=
parseInt
(
e
.
target
.
value
)
if
(
!
isNaN
(
value
))
{
...
...
@@ -24,6 +29,7 @@ class PanelMCQ extends React.Component {
}
}
// this function is called when the input is changed for the desired label type
onChangeLabelType
(
e
)
{
let
value
=
parseInt
(
e
.
target
.
value
)
if
(
!
isNaN
(
value
))
{
...
...
@@ -38,6 +44,11 @@ class PanelMCQ extends React.Component {
}
}
/**
* This function generates an array with the labels for each option
* @param nrLabels the number of options that need to be generated
* @returns {any[]|string[]|number[]}
*/
generateLabels
(
nrLabels
)
{
let
type
=
this
.
state
.
chosenLabelType
...
...
@@ -53,6 +64,10 @@ class PanelMCQ extends React.Component {
}
}
/**
* This function renders the panel with the inputs for generating multiple choice options
* @returns the react component containing the mcq panel
*/
render
()
{
return
(
<
nav
className
=
'panel'
>
...
...
This diff is collapsed.
Click to expand it.
client/views/ExamEditor.jsx
+
1
−
1
View file @
65813440
...
...
@@ -342,7 +342,7 @@ class ExamEditor extends React.Component {
)]
// depending on the rendering option, render the mc_options separately or in a single widget
if
(
widget
.
problem
.
mc_options
.
length
>
0
)
{
if
(
widget
.
problem
.
mc_options
.
length
>
0
&&
!
this
.
props
.
finalized
)
{
elementList
.
push
(
this
.
renderMCWidget
(
widget
))
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment