-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6045 from usu/feat/activity-list-print-react
feat(print): activity list implementation for react print
- Loading branch information
Showing
14 changed files
with
2,985 additions
and
927 deletions.
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
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
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
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,30 @@ | ||
<template> | ||
<Page :id="id" class="page"> | ||
<ActivityListPeriod | ||
v-for="period in periods" | ||
:id="id" | ||
:period="period" | ||
:config="config" | ||
:content-type-names="['LearningObjectives', 'LearningTopics', 'Checklist']" | ||
/> | ||
</Page> | ||
</template> | ||
<script> | ||
import PdfComponent from '@/PdfComponent.js' | ||
import ActivityListPeriod from './ActivityListPeriod.vue' | ||
export default { | ||
name: 'ActivityList', | ||
components: { ActivityListPeriod }, | ||
extends: PdfComponent, | ||
props: { | ||
content: { type: Object, required: true }, | ||
config: { type: Object, required: true }, | ||
}, | ||
computed: { | ||
periods() { | ||
return this.content.options.periods.map((periodUri) => this.api.get(periodUri)) | ||
}, | ||
}, | ||
} | ||
</script> |
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,62 @@ | ||
<template> | ||
<Text | ||
:id="`${id}-${period.id}`" | ||
:bookmark="{ title: title + ': ' + period.description, fit: true }" | ||
class="activity-list-period-title" | ||
>{{ title }}: {{ period.description }}</Text | ||
> | ||
<ActivityListScheduleEntry | ||
v-for="scheduleEntry in scheduleEntries" | ||
:id="id" | ||
:schedule-entry="scheduleEntry" | ||
:content-types="contentTypes" | ||
:content-nodes="contentNodes" | ||
/> | ||
</template> | ||
<script> | ||
import PdfComponent from '@/PdfComponent.js' | ||
import ActivityListScheduleEntry from './ActivityListScheduleEntry.vue' | ||
import camelCase from 'lodash/camelCase.js' | ||
export default { | ||
name: 'ActivityListPeriod', | ||
components: { ActivityListScheduleEntry }, | ||
extends: PdfComponent, | ||
props: { | ||
period: { type: Object, required: true }, | ||
contentTypeNames: { type: Array, required: true }, | ||
config: { type: Object, required: true }, | ||
}, | ||
computed: { | ||
scheduleEntries() { | ||
return this.period.scheduleEntries().items | ||
}, | ||
allContentTypes() { | ||
return this.api.get('/content_types').items | ||
}, | ||
contentTypes() { | ||
return this.contentTypeNames.map((contentTypeName) => | ||
this.allContentTypes.find((contentType) => contentType.name === contentTypeName) | ||
) | ||
}, | ||
contentNodes() { | ||
return this.contentTypes.map((contentType) => | ||
this.period.contentNodes().items.filter((contentNode) => { | ||
return contentNode.contentType()._meta.self === contentType._meta.self | ||
}) | ||
) | ||
}, | ||
title() { | ||
return this.$tc('print.activityList.title') | ||
}, | ||
}, | ||
methods: { camelCase }, | ||
} | ||
</script> | ||
<pdf-style> | ||
.activity-list-period-title { | ||
font-size: 10pt; | ||
font-weight: bold; | ||
text-align: center; | ||
} | ||
</pdf-style> |
44 changes: 44 additions & 0 deletions
44
pdf/src/campPrint/activityList/ActivityListScheduleEntry.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,44 @@ | ||
<template> | ||
<ScheduleEntryTitle :schedule-entry="scheduleEntry" :show-header="false" /> | ||
|
||
<View style="margin-top: 10pt; padding-bottom: 20pt; font-size: 10pt"> | ||
<ContentNode | ||
v-for="contentNode in contentNodeEntries" | ||
:key="contentNode.id" | ||
:content-node="contentNode" | ||
/> | ||
</View> | ||
</template> | ||
<script> | ||
import PdfComponent from '@/PdfComponent.js' | ||
import ScheduleEntryTitle from '../scheduleEntry/ScheduleEntryTitle.vue' | ||
import ContentNode from '../scheduleEntry/contentNode/ContentNode.vue' | ||
import sortBy from 'lodash/sortBy.js' | ||
export default { | ||
name: 'ScheduleEntry', | ||
components: { ContentNode, ScheduleEntryTitle }, | ||
extends: PdfComponent, | ||
props: { | ||
scheduleEntry: { type: Object, required: true }, | ||
contentTypes: { type: Array, required: true }, | ||
contentNodes: { type: Array, required: true }, | ||
}, | ||
computed: { | ||
contentNodeEntries() { | ||
return sortBy( | ||
this.contentNodes.map((contentNodeList) => | ||
contentNodeList.filter( | ||
(contentNode) => | ||
contentNode.root()._meta.self === | ||
this.scheduleEntry.activity().rootContentNode()._meta.self | ||
) | ||
), | ||
['parent', 'slot', 'position'] | ||
).flat() | ||
}, | ||
}, | ||
} | ||
</script> | ||
<pdf-style> | ||
</pdf-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
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.