Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Public activity series
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksellen committed Jan 16, 2024
1 parent 47cff45 commit d206f30
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/activities/api/activitySeries.js
@@ -1,9 +1,10 @@
import axios from '@/base/api/axios'
import { toFormData } from '@/utils/utils'

export default {

async create (series) {
return convert((await axios.post('/api/activity-series/', serialize(series))).data)
return convert((await axios.post('/api/activity-series/', await toFormData(serialize(series)))).data)
},

async get (seriesId) {
Expand All @@ -16,7 +17,7 @@ export default {

async save (series) {
const { id } = series
return convert((await axios.patch(`/api/activity-series/${id}/`, serialize(series))).data)
return convert((await axios.patch(`/api/activity-series/${id}/`, await toFormData(serialize(series)))).data)
},

async checkSave (series) {
Expand Down
2 changes: 1 addition & 1 deletion src/activities/components/ActivityItem.vue
Expand Up @@ -437,7 +437,7 @@ const icsUrl = computed(() => {
return absoluteURL(`/api/activities/${activity.value.id}/ics/`)
})
const bannerImageURL = computed(() => {
return activity.value?.bannerImageUrls?.fullSize
return activity.value?.bannerImageUrls?.fullSize ?? activity.value?.seriesBannerImageUrls?.fullSize
})
function join () {
Expand Down
45 changes: 45 additions & 0 deletions src/activities/components/ActivitySeriesEdit.vue
Expand Up @@ -290,6 +290,49 @@
@maybe-save="maybeSave"
/>

<QField
borderless
hide-bottom-space
>
<QToggle
v-model="edit.isPublic"
:label="$t('CREATEACTIVITY.MAKE_IT_PUBLIC')"
/>
</QField>

<QField
v-if="edit.isPublic"
borderless
stack-label
bottom-slots
:label="$t('CREATEACTIVITY.BANNER_IMAGE')"
>
<template #hint>
<i18n-t
scope="global"
keypath="CREATEACTIVITY.BANNER_IMAGE_TIP"
>
<template #website>
<a
rel="noopener nofollow noreferrer"
class="fas-after fa-after-external-link"
target="_blank"
href="https://www.pexels.com/search/banner/?orientation=landscape"
>pexels.com</a>
</template>
</i18n-t>
</template>
<ChooseImage
v-model="edit.bannerImage"
:image-url="value.bannerImageUrls?.fullSize"
:aspect-ratio="26/9"
width="100%"
:title="$t('CREATEACTIVITY.BANNER_IMAGE')"
:dialog-title="$t('CREATEACTIVITY.SELECT_BANNER_IMAGE')"
class="q-mt-sm"
/>
</QField>
<div
v-if="hasNonFieldError"
class="text-negative"
Expand Down Expand Up @@ -386,12 +429,14 @@ import statusMixin from '@/utils/mixins/statusMixin'
import ConfirmUserChangesDialog from '@/activities/components/ConfirmUserChangesDialog.vue'
import ParticipantTypesEdit from '@/activities/components/ParticipantTypesEdit.vue'
import ChooseImage from '@/utils/components/ChooseImage.vue'
import MarkdownInput from '@/utils/components/MarkdownInput.vue'
const ActivityItem = defineAsyncComponent(() => import('@/activities/components/ActivityItem.vue'))
export default {
components: {
ChooseImage,
ActivityItem,
QTime,
QField,
Expand Down
2 changes: 1 addition & 1 deletion src/activities/pages/PublicActivity.vue
Expand Up @@ -207,7 +207,7 @@ const activityType = computed(() => publicActivity.value?.activityType)
const place = computed(() => publicActivity.value?.place)
const group = computed(() => place.value?.group)
const bannerImageURL = computed(() => publicActivity.value?.bannerImageUrls?.fullSize)
const bannerImageURL = computed(() => publicActivity.value?.bannerImageUrls?.fullSize ?? publicActivity.value?.seriesBannerImageUrls?.fullSize)

Check warning on line 210 in src/activities/pages/PublicActivity.vue

View check run for this annotation

Codecov / codecov/patch

src/activities/pages/PublicActivity.vue#L210

Added line #L210 was not covered by tests
const groupImageURL = computed(() => group.value?.photoUrls?.[200])
const icsUrl = computed(() => {
Expand Down
8 changes: 6 additions & 2 deletions src/groupInfo/pages/GroupPreview.vue
Expand Up @@ -182,8 +182,8 @@
@click="$router.push({ name: 'publicActivity', params: { activityPublicId: publicActivity.publicId } })"
>
<QImg
v-if="publicActivity.bannerImageUrls?.fullSize"
:src="publicActivity.bannerImageUrls.fullSize"
v-if="getBannerImageUrl(publicActivity)"
:src="getBannerImageUrl(publicActivity)"
class="full-width"
style="max-height: 80px;"
/>
Expand Down Expand Up @@ -294,6 +294,10 @@ const {
const application = computed(() => applications.value.find(a => a.group === unref(groupPreviewId)))
function getBannerImageUrl (publicActivity) {
return publicActivity?.bannerImageUrls?.fullSize ?? publicActivity?.seriesBannerImageUrls?.fullSize

Check warning on line 298 in src/groupInfo/pages/GroupPreview.vue

View check run for this annotation

Codecov / codecov/patch

src/groupInfo/pages/GroupPreview.vue#L297-L298

Added lines #L297 - L298 were not covered by tests
}
async function withdraw () {
Dialog.create({
title: t('JOINGROUP.WITHDRAW_CONFIRMATION_HEADER'),
Expand Down

0 comments on commit d206f30

Please sign in to comment.