-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edit modal - add additional fields to "Basic info" section #3370
Merged
rtibbles
merged 18 commits into
learningequality:unstable
from
sairina:metadata-basic-info
Apr 28, 2022
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
0176d65
Add grade_levels field
sairina 2fc9a5d
Add tests for grade_levels field
sairina 1e99cf0
Add learner_needs field
sairina c485d63
Update strings for resources needed/learner_needs field
sairina 49718ef
Move logic for determining dropdown list into separate method and const
sairina 56a48d5
Add tests for learner_needs field
sairina dd2b072
Initial addition of learning_activities metadata field
sairina 4c49de4
Add validation to learning_activities
sairina 7af90a3
Remove default upload for learning_activity for now
sairina 25a29be
Add tests for learning activities
sairina 2c3b79d
Update validation tests with learning activities
sairina 04a671e
Add learning activities for tests in actions
sairina 62adde4
Update Basic Information section to two column format
sairina d6a0d94
Change key for learning_activity in tests
sairina 201c6e4
Move update method to module scope
sairina ff3a1fe
Add test for emitting with v-model
sairina 2305dd9
Move update method and export
sairina 27b40d3
Update tests to add change of state with emit
sairina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...curation/contentcuration/frontend/channelEdit/components/edit/LearningActivityOptions.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<template> | ||
|
||
<VSelect | ||
v-model="learningActivity" | ||
:items="learningActivities" | ||
box | ||
chips | ||
clearable | ||
:label="translateMetadataString('learningActivity')" | ||
multiple | ||
deletableChips | ||
:rules="learningActivityRules" | ||
/> | ||
|
||
</template> | ||
|
||
<script> | ||
|
||
import { camelCase } from 'lodash'; | ||
import { LearningActivities } from 'shared/constants'; | ||
import { constantsTranslationMixin, metadataTranslationMixin } from 'shared/mixins'; | ||
import { getLearningActivityValidators, translateValidator } from 'shared/utils/validation'; | ||
|
||
export default { | ||
name: 'LearningActivityOptions', | ||
mixins: [constantsTranslationMixin, metadataTranslationMixin], | ||
props: { | ||
value: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
}, | ||
computed: { | ||
learningActivity: { | ||
get() { | ||
return this.value; | ||
}, | ||
set(value) { | ||
this.$emit('input', value); | ||
}, | ||
}, | ||
learningActivities() { | ||
return Object.entries(LearningActivities).map(activity => ({ | ||
text: this.translateMetadataString(camelCase(activity[0])), | ||
value: activity[1], | ||
})); | ||
}, | ||
learningActivityRules() { | ||
return getLearningActivityValidators().map(translateValidator); | ||
}, | ||
}, | ||
}; | ||
|
||
</script> | ||
<style lang="scss"> | ||
</style> |
70 changes: 70 additions & 0 deletions
70
contentcuration/contentcuration/frontend/channelEdit/components/edit/LevelsOptions.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<template> | ||
|
||
<VSelect | ||
ref="level" | ||
v-model="level" | ||
:items="levels" | ||
box | ||
chips | ||
clearable | ||
:label="translateMetadataString('level')" | ||
multiple | ||
deletableChips | ||
/> | ||
|
||
</template> | ||
|
||
<script> | ||
|
||
import { camelCase } from 'lodash'; | ||
import { ContentLevels } from 'shared/constants'; | ||
import { constantsTranslationMixin, metadataTranslationMixin } from 'shared/mixins'; | ||
|
||
export default { | ||
name: 'LevelsOptions', | ||
mixins: [constantsTranslationMixin, metadataTranslationMixin], | ||
props: { | ||
value: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
}, | ||
computed: { | ||
level: { | ||
get() { | ||
return this.value; | ||
}, | ||
set(value) { | ||
this.$emit('input', value); | ||
}, | ||
}, | ||
/** | ||
* List of levels to show in the dropdown, taking into account mapping | ||
* to levels in the constants that do not have an exact matching corresponding string | ||
* @returns {Array} | ||
*/ | ||
levels() { | ||
return Object.entries(ContentLevels).map(level => { | ||
let translationKey; | ||
if (level[0] === 'PROFESSIONAL') { | ||
translationKey = 'specializedProfessionalTraining'; | ||
} else if (level[0] === 'WORK_SKILLS') { | ||
translationKey = 'allLevelsWorkSkills'; | ||
} else if (level[0] === 'BASIC_SKILLS') { | ||
translationKey = 'allLevelsBasicSkills'; | ||
} else { | ||
translationKey = camelCase(level[0]); | ||
} | ||
return { | ||
text: this.translateMetadataString(translationKey), | ||
value: level[1], | ||
}; | ||
}); | ||
}, | ||
}, | ||
}; | ||
|
||
</script> | ||
<style lang="scss"> | ||
|
||
</style> |
76 changes: 76 additions & 0 deletions
76
...tcuration/contentcuration/frontend/channelEdit/components/edit/ResourcesNeededOptions.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<template> | ||
|
||
<VSelect | ||
ref="need" | ||
v-model="need" | ||
:items="resources" | ||
box | ||
chips | ||
:label="$tr('resourcesNeededLabel')" | ||
multiple | ||
deletableChips | ||
clearable | ||
/> | ||
|
||
</template> | ||
|
||
<script> | ||
|
||
import { ResourcesNeededTypes } from 'shared/constants'; | ||
import { constantsTranslationMixin, metadataTranslationMixin } from 'shared/mixins'; | ||
|
||
/** | ||
* @param {array} listOfKeys | ||
* @returns {Object} | ||
* | ||
* Determines resources to show in the dropdown, to remove resources | ||
* that do not currently need to be displayed in Kolibri | ||
*/ | ||
export function updateResourcesDropdown(listOfKeys) { | ||
if (listOfKeys) { | ||
return Object.keys(ResourcesNeededTypes).reduce((acc, key) => { | ||
if (listOfKeys.indexOf(key) === -1) { | ||
acc[key] = ResourcesNeededTypes[key]; | ||
} | ||
return acc; | ||
}, {}); | ||
} | ||
} | ||
|
||
//the variable below can be changed or removed when metadata/Kolibri is updated | ||
const keysToBeTemporarilyRemoved = ['PEERS', 'TEACHER', 'PRIOR_KNOWLEDGE', 'MATERIALS']; | ||
const dropdown = updateResourcesDropdown(keysToBeTemporarilyRemoved) || ResourcesNeededTypes; | ||
|
||
export default { | ||
name: 'ResourcesNeededOptions', | ||
mixins: [constantsTranslationMixin, metadataTranslationMixin], | ||
props: { | ||
value: { | ||
type: Array, | ||
default: () => [], | ||
}, | ||
}, | ||
computed: { | ||
need: { | ||
get() { | ||
return this.value; | ||
}, | ||
set(value) { | ||
this.$emit('input', value); | ||
}, | ||
}, | ||
resources() { | ||
return Object.entries(dropdown).map(resource => ({ | ||
text: this.translateMetadataString(resource[0]), | ||
value: resource[1], | ||
})); | ||
}, | ||
}, | ||
$trs: { | ||
resourcesNeededLabel: 'What you will need', | ||
}, | ||
}; | ||
|
||
</script> | ||
<style lang="scss"> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @marcellamaki we might want to consolidate this logic somewhere like I think we did on Kolibri?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I stole that from Kolibri: https://github.com/learningequality/kolibri/blob/develop/kolibri/plugins/learn/assets/src/views/EmbeddedSidePanel/SelectGroup.vue#L139