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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Works on my machine
zesje
Commits
eabc9aae
Commit
eabc9aae
authored
May 22, 2018
by
Justin van der Krieken
Browse files
Options
Downloads
Patches
Plain Diff
Introduce tabs for exam page
parent
7aac510f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/index.jsx
+11
-6
11 additions, 6 deletions
client/index.jsx
client/views/Exam.jsx
+54
-4
54 additions, 4 deletions
client/views/Exam.jsx
with
65 additions
and
10 deletions
client/index.jsx
+
11
−
6
View file @
eabc9aae
...
...
@@ -3,7 +3,7 @@ import 'font-awesome/css/font-awesome.css';
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
Loadable
from
'
react-loadable
'
;
import
{
BrowserRouter
as
Router
,
Route
,
Switch
}
from
'
react-router-dom
'
;
import
{
BrowserRouter
as
Router
,
Route
,
Switch
,
Redirect
}
from
'
react-router-dom
'
;
import
*
as
api
from
'
./api.jsx
'
...
...
@@ -118,8 +118,13 @@ class App extends React.Component {
<
NavBar
exam
=
{
exam
}
updateExam
=
{
this
.
updateExam
}
ref
=
{
this
.
menu
}
/>
<
Switch
>
<
Route
exact
path
=
"/"
component
=
{
Home
}
/>
<
Route
path
=
"/exams/:examID"
render
=
{
({
match
})
=>
<
Exam
exam
=
{
exam
}
urlID
=
{
match
.
params
.
examID
}
updateExam
=
{
this
.
updateExam
}
updateSubmission
=
{
this
.
updateSubmission
}
/>
}
/>
<
Route
path
=
"/exams/:examID/:action?"
render
=
{
({
match
})
=>
<
Exam
exam
=
{
exam
}
urlID
=
{
match
.
params
.
examID
}
action
=
{
match
.
params
.
action
||
'
edit
'
}
updateExam
=
{
this
.
updateExam
}
updateSubmission
=
{
this
.
updateSubmission
}
/>
}
/>
<
Route
path
=
"/exams"
render
=
{
({
history
})
=>
<
AddExam
updateExamList
=
{
()
=>
this
.
menu
.
current
.
updateExamList
()
}
changeURL
=
{
history
.
push
}
/>
}
/>
<
Route
path
=
"/students"
render
=
{
()
=>
...
...
This diff is collapsed.
Click to expand it.
client/views/Exam.jsx
+
54
−
4
View file @
eabc9aae
...
...
@@ -4,6 +4,7 @@ import Dropzone from 'react-dropzone';
import
Hero
from
'
../components/Hero.jsx
'
;
import
DropzoneContent
from
'
../components/DropzoneContent.jsx
'
;
import
PDFEditor
from
'
../components/PDFEditor.jsx
'
;
import
{
Link
}
from
'
react-router-dom
'
import
*
as
api
from
'
../api.jsx
'
...
...
@@ -32,12 +33,61 @@ class Exams extends React.Component {
if
(
this
.
props
.
urlID
!==
this
.
props
.
exam
.
id
)
this
.
props
.
updateExam
(
this
.
props
.
urlID
)
}
renderContent
=
(
action
)
=>
{
switch
(
action
)
{
case
'
preview
'
:
return
<
div
>
preview
</
div
>
case
'
export
'
:
return
<
div
>
export
</
div
>
case
'
edit
'
:
return
<
PDFEditor
exam
=
{
this
.
props
.
exam
}
examID
=
{
this
.
state
.
examID
}
/>
default
:
return
<
div
>
Unsupported action
</
div
>
}
}
renderTabs
=
()
=>
{
const
tabs
=
[
{
name
:
'
Edit
'
,
action
:
'
edit
'
,
icon
:
'
fa-edit
'
,
},
{
name
:
'
Preview
'
,
action
:
'
preview
'
,
icon
:
'
fa-eye
'
,
},
{
name
:
'
Export
'
,
action
:
'
export
'
,
icon
:
'
fa-download
'
,
},
]
return
(
<
div
className
=
'tabs is-centered'
>
<
ul
>
{
tabs
.
map
(
tab
=>
<
li
key
=
{
tab
.
action
}
className
=
{
this
.
props
.
action
===
tab
.
action
?
'
is-active
'
:
''
}
>
<
Link
to
=
{
'
/exams/
'
+
this
.
props
.
urlID
+
'
/
'
+
tab
.
action
}
>
<
span
className
=
'icon is-small'
><
i
className
=
{
'
fa
'
+
tab
.
icon
}
aria-hidden
=
'true'
></
i
></
span
>
<
span
>
{
tab
.
name
}
</
span
>
</
Link
>
</
li
>
)
}
</
ul
>
</
div
>
)
}
render
()
{
const
renderContent
=
this
.
renderContent
(
this
.
props
.
action
)
return
<
div
>
<
Hero
title
=
"Exam details"
subtitle
=
{
"
Selected:
"
+
this
.
props
.
exam
.
name
}
/>
<
section
className
=
"section"
>
<
div
className
=
"container"
>
<
PDFEditor
examID
=
{
this
.
state
.
examID
}
/>
<
Hero
title
=
'Exam details'
subtitle
=
{
'
Selected:
'
+
this
.
props
.
exam
.
name
}
/>
<
section
className
=
'section'
>
{
this
.
renderTabs
()
}
<
div
className
=
'container'
>
{
renderContent
}
</
div
>
</
section
>
</
div
>
...
...
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