Skip to content

Commit

Permalink
feat: add member level required to access the video
Browse files Browse the repository at this point in the history
this closes #175
  • Loading branch information
marianzburlea committed Sep 9, 2019
1 parent a3cbcbf commit fdc17c6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
41 changes: 22 additions & 19 deletions src/component/_dumb/dynamic-form/dynamic-form.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,28 @@ const DynamicForm = ({ schema, data, dbItem }) => {

const renderForm = () =>
Object.keys(filedList).map(field => {
const { type, value, placeholder, label } = filedList[field];
switch (type) {
case 'text':
case 'date':
case 'datetime-local':
return (
<TextInput
key={field}
id={field}
type={type}
formId={formId}
label={label}
value={value}
onEvent={onEvent}
placeholder={placeholder}
/>
);
default:
return null
const { type, value, placeholder, label, visible } = filedList[field];
if (visible) {
switch (type) {
case 'text':
case 'date':
case 'number':
case 'datetime-local':
return (
<TextInput
key={field}
id={field}
type={type}
formId={formId}
label={label}
value={value}
onEvent={onEvent}
placeholder={placeholder}
/>
);
default:
return null
}
}
});

Expand Down
1 change: 1 addition & 0 deletions src/component/lecture-panel/lecture-panel.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const LecturePanel = ({ section = {}, course = {}, setShowAddLectureId, lectureL
// take out the id, as it sould be null
let { id, ...restOfLecture } = lecture
restOfLecture.order = lectureListLength
restOfLecture.levelRequired = 0

// we want to add a lecture
const newLecture = await lectureCollection.add(restOfLecture)
Expand Down
9 changes: 9 additions & 0 deletions src/component/lecture/lecture.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ export default {
visible: true,
value: false
},
levelRequired: {
type: 'number',
placeholder: 'Level required to view',
label: 'Level required to view',
defaultValue: 0,
edit: true,
visible: true,
value: 0
},
order: {
type: 'number',
defaultValue: 0,
Expand Down

0 comments on commit fdc17c6

Please sign in to comment.