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
2dae7e51
Commit
2dae7e51
authored
5 years ago
by
jtimotei
Browse files
Options
Downloads
Patches
Plain Diff
Labels and number inputs on one line
parent
0a50ed4e
No related branches found
Branches containing commit
No related tags found
1 merge request
!31
Layout side panel
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client/components/PaneMCQ.jsx
+22
-20
22 additions, 20 deletions
client/components/PaneMCQ.jsx
client/components/PanelMCQ.css
+15
-1
15 additions, 1 deletion
client/components/PanelMCQ.css
client/views/Exam.jsx
+3
-2
3 additions, 2 deletions
client/views/Exam.jsx
with
40 additions
and
23 deletions
client/components/PaneMCQ.jsx
+
22
−
20
View file @
2dae7e51
...
...
@@ -62,7 +62,7 @@ class PanelMCQ extends React.Component {
// 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
))
{
if
(
!
isNaN
(
value
)
&&
value
<=
this
.
props
.
totalNrAnswers
)
{
if
(
this
.
state
.
chosenLabelType
===
1
)
{
value
=
2
}
...
...
@@ -140,25 +140,27 @@ class PanelMCQ extends React.Component {
{
this
.
props
.
problem
.
mc_options
.
length
>
0
?
(
<
React
.
Fragment
>
<
div
className
=
'panel-block mcq-block'
>
<
label
>
Number options
</
label
>
<
input
type
=
'number'
value
=
{
this
.
state
.
nrPossibleAnswers
}
min
=
'1'
max
=
{
this
.
props
.
totalNrAnswers
}
className
=
'input'
onChange
=
{
this
.
onChangeNPA
}
/>
</
div
>
<
div
className
=
'panel-block mcq-block'
>
<
label
>
Labels
</
label
>
<
div
className
=
'select is-hovered is-fullwidth'
>
{
(
function
()
{
var
optionList
=
this
.
state
.
labelTypes
.
map
(
(
label
,
i
)
=>
<
option
key
=
{
i
}
value
=
{
String
(
i
)
}
>
{
label
}
</
option
>
)
return
(
<
div
className
=
'select is-hovered is-fullwidth'
>
<
select
value
=
{
this
.
state
.
chosenLabelType
}
onChange
=
{
this
.
onChangeLabelType
}
>
{
optionList
}
</
select
>
</
div
>
)
}.
bind
(
this
)())
}
<
div
className
=
'inline-mcq-edit'
>
<
label
>
#
</
label
>
<
input
type
=
'number'
value
=
{
this
.
state
.
nrPossibleAnswers
}
min
=
'1'
max
=
{
this
.
props
.
totalNrAnswers
}
className
=
'input'
onChange
=
{
this
.
onChangeNPA
}
/>
</
div
>
<
div
className
=
'inline-mcq-edit'
>
<
label
>
Labels
</
label
>
<
div
className
=
'select is-hovered is-fullwidth'
>
{
(
function
()
{
var
optionList
=
this
.
state
.
labelTypes
.
map
(
(
label
,
i
)
=>
<
option
key
=
{
i
}
value
=
{
String
(
i
)
}
>
{
label
}
</
option
>
)
return
(
<
div
className
=
'select is-hovered is-fullwidth'
>
<
select
value
=
{
this
.
state
.
chosenLabelType
}
onChange
=
{
this
.
onChangeLabelType
}
>
{
optionList
}
</
select
>
</
div
>
)
}.
bind
(
this
)())
}
</
div
>
</
div
>
</
div
>
</
React
.
Fragment
>)
:
null
...
...
This diff is collapsed.
Click to expand it.
client/components/PanelMCQ.css
+
15
−
1
View file @
2dae7e51
.panel-block.mcq-block
{
justify-content
:
space-between
;
border-top
:
none
;
}
.mcq-block
.inline-mcq-edit
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
flex-wrap
:
nowrap
;
}
.mcq-block
.inline-mcq-edit
label
{
margin-right
:
4px
;
}
.mcq-block
.inline-mcq-edit
:first-of-type
{
margin-right
:
20px
;
}
.mcq-block
input
,
.mcq-block
.select
{
...
...
This diff is collapsed.
Click to expand it.
client/views/Exam.jsx
+
3
−
2
View file @
2dae7e51
...
...
@@ -476,7 +476,8 @@ class Exams extends React.Component {
let
selectedWidget
=
selectedWidgetId
&&
this
.
state
.
widgets
[
selectedWidgetId
]
let
problem
=
selectedWidget
&&
selectedWidget
.
problem
let
isMCQ
=
(
problem
&&
problem
.
mc_options
.
length
>
0
)
||
false
let
widgetEditDisabled
=
(
this
.
state
.
previewing
||
!
problem
)
||
(
this
.
props
.
exam
.
finalized
&&
containsMCOptions
)
let
widgetEditDisabled
=
(
this
.
state
.
previewing
||
!
problem
)
||
(
this
.
props
.
exam
.
finalized
&&
problem
.
mc_options
.
length
>
0
)
let
isGraded
=
problem
&&
problem
.
graded
let
widgetDeleteDisabled
=
widgetEditDisabled
||
isGraded
...
...
@@ -529,7 +530,7 @@ class Exams extends React.Component {
PanelEdit
=
(
props
)
=>
{
const
selectedWidgetId
=
this
.
state
.
selectedWidgetId
let
totalNrAnswers
=
12
// the upper limit for the nr of possible answer boxes
let
totalNrAnswers
=
9
// the upper limit for the nr of possible answer boxes
return
(
<
nav
className
=
'panel'
>
...
...
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