Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pvk-tool
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
amiv
pvk-tool
Commits
330d3af0
Commit
330d3af0
authored
Dec 03, 2017
by
rcelina
Committed by
Alexander Dietmüller
Mar 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Frontend: progress on creating lectures and courses
parent
ee90eeec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
28 deletions
+75
-28
Frontend/src/CreateCourse.js
Frontend/src/CreateCourse.js
+50
-12
Frontend/src/CreateLecture.js
Frontend/src/CreateLecture.js
+25
-16
No files found.
Frontend/src/CreateCourse.js
View file @
330d3af0
...
...
@@ -2,8 +2,9 @@
const
m
=
require
(
'
mithril
'
);
const
{
lectures
}
=
require
(
'
./backend.js
'
);
const
currentCourse
=
{
courseList
:
[
'
Hermann
'
,
'
Alex
'
,
'
Eppi
'
],
assistantList
:
[
'
Mathis
'
,
'
Sandro
'
,
'
Celina
'
],
spots
:
'
42
'
,
assistant
:
'
Mo
'
,
...
...
@@ -19,6 +20,12 @@ const currentCourse = {
};
function
assistantList
()
{
if
(
!
currentCourse
.
lecture
)
{
return
[];
}
return
lectures
.
list
.
find
(({
_id
})
=>
_id
===
currentCourse
.
lecture
).
assistants
;
}
function
bind
(
obj
,
prop
,
type
=
'
text
'
)
{
return
{
value
:
obj
[
prop
],
...
...
@@ -60,11 +67,16 @@ const timespanView = {
const
chosenLecture
=
{
view
()
{
return
[
m
(
'
select
'
,
[
currentCourse
.
courseList
.
map
((
_
,
index
)
=>
[
m
(
'
option
'
,
currentCourse
.
courseList
[
index
]),
]),
]),
m
(
'
select
'
,
{
onchange
:
m
.
withAttr
(
'
selectedIndex
'
,
(
index
)
=>
{
currentCourse
.
lecture
=
lectures
.
list
[
index
].
_id
;
}),
},
lectures
.
list
.
map
(
lecture
=>
m
(
'
option
'
,
lecture
.
title
)),
),
];
},
};
...
...
@@ -73,8 +85,8 @@ const chosenAssistant = {
view
()
{
return
[
m
(
'
select
'
,
[
currentCourse
.
assistantList
.
map
((
_
,
index
)
=>
[
m
(
'
option
'
,
currentCourse
.
assistantList
[
index
]
),
assistantList
().
map
(
assistant
=>
[
m
(
'
option
'
,
assistant
),
]),
]),
];
...
...
@@ -107,12 +119,22 @@ const courseRoom = {
},
};
function
addDatetime
()
{
currentCourse
.
datetimes
.
push
(
''
);
}
function
removeDatetime
(
index
)
{
currentCourse
.
datetimes
.
splice
(
index
,
1
);
}
module
.
exports
=
{
oninit
()
{
lectures
.
get
();
},
view
()
{
return
[
m
(
'
div
'
,
'
As Admin, you can add Courses
'
),
m
(
'
div
'
,
'
Choose
Cours
e
'
),
m
(
'
div
'
,
'
Choose
Lectur
e
'
),
m
(
chosenLecture
),
m
(
'
div
'
,
'
Choose Assistant
'
),
m
(
chosenAssistant
),
...
...
@@ -123,9 +145,25 @@ module.exports = {
m
(
'
div
'
,
'
What time does the course signup start and end?
'
),
m
(
'
div
'
),
m
(
timespanView
,
{
timespan
:
currentCourse
.
signup
}),
m
(
'
div
'
,
'
What time does the course start and end?
'
),
currentCourse
.
datetimes
.
map
(
timespan
=>
m
(
timespanView
,
{
timespan
})),
m
(
'
div
'
,
'
What time does the ourcse start and end?
'
),
currentCourse
.
datetimes
.
map
((
timespan
,
index
)
=>
[
m
(
timespanView
,
{
timespan
}),
m
(
'
button
'
,
{
onclick
()
{
removeDatetime
(
index
);
},
},
'
Remove course time
'
,
),
m
(
'
div
'
),
]),
m
(
'
button
'
,
{
onclick
:
addDatetime
},
'
Add other course time
'
,
),
];
},
};
Frontend/src/CreateLecture.js
View file @
330d3af0
...
...
@@ -6,17 +6,17 @@ const { lectures } = require('./backend.js');
const
currentLecture
=
{
title
:
'
Hallo
'
,
department
:
'
Alex
'
,
year
:
'
4
2
'
,
assistant
:
[
'
rcelina
'
,
'
rstadler
'
,
'
troll
'
],
department
:
'
itet
'
,
year
:
'
2
'
,
assistant
s
:
[
'
rcelina
'
,
'
rstadler
'
,
'
troll
'
],
};
function
addAssistant
()
{
currentLecture
.
assistant
.
push
(
''
);
function
addAssistant
s
()
{
currentLecture
.
assistant
s
.
push
(
''
);
}
function
removeAssistant
(
index
)
{
currentLecture
.
assistant
.
splice
(
index
,
1
);
function
removeAssistant
s
(
index
)
{
currentLecture
.
assistant
s
.
splice
(
index
,
1
);
}
function
bind
(
obj
,
prop
)
{
...
...
@@ -45,28 +45,28 @@ const enterField = {
m
(
'
input
'
,
bind
(
currentLecture
,
'
department
'
)),
m
(
'
div
'
,
'
Year:
'
),
m
(
'
input
'
,
bind
(
currentLecture
,
'
year
'
)),
m
(
'
div
'
,
'
Assistant:
'
),
currentLecture
.
assistant
.
map
((
_
,
index
)
=>
[
m
(
'
div
'
,
'
Assistant
s
:
'
),
currentLecture
.
assistant
s
.
map
((
_
,
index
)
=>
[
m
(
'
div
'
,
[
m
(
'
input
'
,
bind
(
currentLecture
.
assistant
,
index
),
bind
(
currentLecture
.
assistant
s
,
index
),
),
m
(
'
button
'
,
{
onclick
()
{
removeAssistant
(
index
);
removeAssistant
s
(
index
);
},
},
'
Remove Assistant
'
,
'
Remove Assistant
s
'
,
),
]),
]),
m
(
'
button
'
,
{
onclick
:
addAssistant
},
'
Add Assistant
'
,
{
onclick
:
addAssistant
s
},
'
Add Assistant
s
'
,
),
];
},
...
...
@@ -101,8 +101,17 @@ module.exports = {
{
onclick
:
createLecture
},
'
Create Lecture
'
,
),
m
(
'
div
'
,
lectures
.
list
.
map
(({
title
})
=>
m
(
'
div
'
,
title
))),
m
(
'
div
'
,
lectures
.
list
.
map
(({
title
,
_id
})
=>
[
m
(
'
div
'
,
title
,
m
(
'
button
'
,
{
onclick
()
{
lectures
.
deleteItem
(
_id
);
}
},
'
Delete
'
,
),
),
])),
];
},
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment