-
Notifications
You must be signed in to change notification settings - Fork 62
feat(print): activity list for courses #6031
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d216bc0
initial draft for printing activity list
usu 68ef354
flatten list of contentNodes
usu 8bb1f07
add contentType to title if intanceName is overriden
usu 605ed33
implement printing of Checklist ContentNodes
usu f729c09
fix lodash imports
usu 6a8af1f
fix data loading for single activity print
usu 7ff0dba
Merge remote-tracking branch 'ecamp/devel' into feat/activity-list
usu 2d9f109
add checklist numbers and sort according to numbers
usu b2a175a
improve rendering of checklist elements
usu c940e55
add tests for config repair
usu 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 hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
55 changes: 55 additions & 0 deletions
55
frontend/src/components/print/config/ActivityListConfig.vue
This file contains hidden or 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,55 @@ | ||
| <template> | ||
| <div> | ||
| <e-select | ||
| v-model="options.periods" | ||
| :items="periods" | ||
| :label="$tc('print.config.periods')" | ||
| multiple | ||
| :filled="false" | ||
| @input="$emit('input')" | ||
| /> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script> | ||
| export default { | ||
| name: 'ActivityListConfig', | ||
| props: { | ||
| value: { type: Object, required: true }, | ||
| camp: { type: Object, required: true }, | ||
| }, | ||
| computed: { | ||
| options: { | ||
| get() { | ||
| return this.value | ||
| }, | ||
| set(v) { | ||
| this.$emit('input', v) | ||
| }, | ||
| }, | ||
| periods() { | ||
| return this.camp.periods().items.map((p) => ({ | ||
| value: p._meta.self, | ||
| text: p.description, | ||
| })) | ||
| }, | ||
| }, | ||
| defaultOptions() { | ||
| return { | ||
| periods: [], | ||
| } | ||
| }, | ||
| design: { | ||
| multiple: true, | ||
| }, | ||
| repairConfig(config, camp) { | ||
| if (!config.options) config.options = {} | ||
| if (!config.options.periods) config.options.periods = [] | ||
| const knownPeriods = camp.periods().items.map((p) => p._meta.self) | ||
| config.options.periods = config.options.periods.filter((period) => { | ||
| return knownPeriods.includes(period) | ||
| }) | ||
| return config | ||
| }, | ||
| } | ||
| </script> | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,71 @@ | ||
| <template> | ||
| <div class="tw-break-after-page"> | ||
| <h1 | ||
| :id="`content_${index}_period_${period.id}`" | ||
| class="tw-text-center tw-font-semibold tw-mb-6" | ||
| > | ||
| {{ $t('print.activityList.title') }}: | ||
| {{ period.description }} | ||
| </h1> | ||
|
|
||
| <generic-error-message v-if="error" :error="error" /> | ||
|
|
||
| <activity-list-schedule-entry | ||
| v-for="scheduleEntry in data.scheduleEntries" | ||
| :key="scheduleEntry.id" | ||
| :schedule-entry="scheduleEntry" | ||
| :content-types="data.contentTypes" | ||
| :content-nodes="data.contentNodes" | ||
| :index="index" | ||
| /> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| const props = defineProps({ | ||
| camp: { type: Object, required: true }, | ||
| period: { | ||
| type: Object, | ||
| required: true, | ||
| }, | ||
| contentTypeNames: { | ||
| type: Array, | ||
| required: true, | ||
| }, | ||
| index: { type: Number, required: true }, | ||
| }) | ||
|
|
||
| const { $api } = useNuxtApp() | ||
|
|
||
| const { data, error } = await useAsyncData( | ||
| `ActivityListPeriod-${props.period._meta.self}`, | ||
| async () => { | ||
| const allContentTypes = (await $api.get().contentTypes().$loadItems()).items | ||
|
|
||
| const contentTypes = props.contentTypeNames.map((contentTypeName) => | ||
| allContentTypes.find((contentType) => contentType.name === contentTypeName) | ||
| ) | ||
|
|
||
| const contentNodePromises = contentTypes.map((contentType) => | ||
| $api | ||
| .get() | ||
| .contentNodes({ | ||
| period: props.period._meta.self, | ||
| contentType: contentType._meta.self, | ||
| }) | ||
| .$loadItems() | ||
| ) | ||
| const contentNodes = await Promise.all(contentNodePromises) | ||
|
|
||
| const [scheduleEntries] = await Promise.all([ | ||
| props.period.scheduleEntries().$loadItems(), | ||
| ]) | ||
|
|
||
| return { | ||
| scheduleEntries: scheduleEntries.items, | ||
| contentNodes, | ||
| contentTypes, | ||
| } | ||
| } | ||
| ) | ||
| </script> |
Oops, something went wrong.
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.
Here some tests would be good
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.
Fixed with c940e55