Skip to content

Commit 5f0de3a

Browse files
committed
Adjust UI to limited permissions of outsiders
1 parent 5f038d3 commit 5f0de3a

File tree

11 files changed

+104
-51
lines changed

11 files changed

+104
-51
lines changed

frontend/src/components/activity/ScheduleEntry.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Displays a single scheduleEntry
264264
/>
265265
</v-col>
266266
</v-row>
267-
<v-row dense>
267+
<v-row v-if="!isOutsider" dense>
268268
<v-col>
269269
<ActivityResponsibles
270270
:activity="activity"

frontend/src/components/navigation/UserMeta.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ export default {
191191
authUser: 'getLoggedInUser',
192192
}),
193193
currentCampCollaboration() {
194+
if (
195+
typeof this.camp?.campCollaborations !== 'function' ||
196+
this.camp.campCollaborations()._meta.loading
197+
) {
198+
return undefined
199+
}
194200
return this.camp
195201
?.campCollaborations()
196202
.items.find(

frontend/src/components/print/config/DialogScheduleEntryFilter.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
:camp="camp"
2828
:filter-fn="filterFn"
2929
:loading-endpoints="{}"
30+
:hide-self-filter="isOutsider"
3031
:hide-period-filter="hidePeriodFilter"
32+
:hide-collaborator-filter="isOutsider"
3133
:hide-day-filter="hideDayFilter"
3234
/>
3335
<template #moreActions>
@@ -38,10 +40,12 @@
3840
<script>
3941
import ScheduleEntryFilters from '../../program/ScheduleEntryFilters.vue'
4042
import DetailPane from '../../generic/DetailPane.vue'
43+
import { campRoleMixin } from '../../../mixins/campRoleMixin.js'
4144
4245
export default {
4346
name: 'DialogScheduleEntryFilter',
4447
components: { DetailPane, ScheduleEntryFilters },
48+
mixins: [campRoleMixin],
4549
props: {
4650
camp: { type: Object, required: true },
4751
filterFn: { type: Function, required: true },

frontend/src/components/program/ScheduleEntryFilters.vue

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
class="d-flex flex-wrap items-baseline"
55
style="overflow-y: auto; gap: 10px"
66
>
7-
<BooleanFilter
8-
v-if="loadingEndpoints !== true && loadingEndpoints.campCollaborations !== true"
9-
v-model="showOnlyMyActivities"
10-
:label="$tc('components.program.scheduleEntryFilters.onlyMyActivities')"
11-
:result-count="myActivitiesCount"
12-
/>
13-
<v-skeleton-loader
14-
v-else
15-
type="button"
16-
class="v-skeleton-loader--inherit-size"
17-
height="32"
18-
width="160px"
19-
/>
20-
<FilterDivider />
7+
<template v-if="!hideSelfFilter">
8+
<BooleanFilter
9+
v-if="loadingEndpoints !== true && loadingEndpoints.campCollaborations !== true"
10+
v-model="showOnlyMyActivities"
11+
:label="$tc('components.program.scheduleEntryFilters.onlyMyActivities')"
12+
:result-count="myActivitiesCount"
13+
/>
14+
<v-skeleton-loader
15+
v-else
16+
type="button"
17+
class="v-skeleton-loader--inherit-size"
18+
height="32"
19+
width="160px"
20+
/>
21+
<FilterDivider />
22+
</template>
2123
<template v-if="!!periods && !hidePeriodFilter">
2224
<template v-if="loadingEndpoints !== true && loadingEndpoints.periods !== true">
2325
<SelectFilter
@@ -37,35 +39,40 @@
3739
width="150"
3840
/>
3941
</template>
40-
<SelectFilter
41-
v-if="loadingEndpoints !== true && loadingEndpoints.campCollaborations !== true"
42-
v-model="value.responsible"
43-
multiple
44-
and-filter
45-
:items="campCollaborations"
46-
:display-field="campCollaborationDisplayName"
47-
:label="$tc('components.program.scheduleEntryFilters.responsible')"
48-
@input="(val) => updateFilter({ responsible: val })"
49-
>
50-
<template #item="{ item }">
51-
<template v-if="item.exclusiveNone">
52-
{{ item.text }}
53-
</template>
54-
<template v-else>
55-
<TextAlignBaseline class="mr-1">
56-
<UserAvatar :camp-collaboration="campCollaborations[item.value]" size="20" />
57-
</TextAlignBaseline>
58-
{{ item.text }}
42+
<template v-if="!hideCollaboratorFilter">
43+
<SelectFilter
44+
v-if="loadingEndpoints !== true && loadingEndpoints.campCollaborations !== true"
45+
v-model="value.responsible"
46+
multiple
47+
and-filter
48+
:items="campCollaborations"
49+
:display-field="campCollaborationDisplayName"
50+
:label="$tc('components.program.scheduleEntryFilters.responsible')"
51+
@input="(val) => updateFilter({ responsible: val })"
52+
>
53+
<template #item="{ item }">
54+
<template v-if="item.exclusiveNone">
55+
{{ item.text }}
56+
</template>
57+
<template v-else>
58+
<TextAlignBaseline class="mr-1">
59+
<UserAvatar
60+
:camp-collaboration="campCollaborations[item.value]"
61+
size="20"
62+
/>
63+
</TextAlignBaseline>
64+
{{ item.text }}
65+
</template>
5966
</template>
60-
</template>
61-
</SelectFilter>
62-
<v-skeleton-loader
63-
v-else
64-
type="button"
65-
class="v-skeleton-loader--inherit-size"
66-
height="32"
67-
width="130"
68-
/>
67+
</SelectFilter>
68+
<v-skeleton-loader
69+
v-else
70+
type="button"
71+
class="v-skeleton-loader--inherit-size"
72+
height="32"
73+
width="130"
74+
/>
75+
</template>
6976
<SelectFilter
7077
v-if="loadingEndpoints !== true && loadingEndpoints.categories !== true"
7178
v-model="value.category"
@@ -184,10 +191,18 @@ export default {
184191
type: Function,
185192
default: () => [],
186193
},
194+
hideSelfFilter: {
195+
type: Boolean,
196+
default: false,
197+
},
187198
hidePeriodFilter: {
188199
type: Boolean,
189200
default: false,
190201
},
202+
hideCollaboratorFilter: {
203+
type: Boolean,
204+
default: false,
205+
},
191206
hideDayFilter: {
192207
type: Boolean,
193208
default: false,

frontend/src/components/program/picasso/Picasso.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ Listing all given activity schedule entries in a calendar view.
5454
)
5555
}}
5656
</div>
57-
<day-responsibles :date="date" :period="period" :readonly="!editable" />
57+
<day-responsibles
58+
v-if="!isOutsider"
59+
:date="date"
60+
:period="period"
61+
:readonly="!editable"
62+
/>
5863
</slot>
5964
</template>
6065

@@ -88,13 +93,15 @@ import DayResponsibles from './DayResponsibles.vue'
8893
import { ONE_DAY_IN_MILLISECONDS } from '@/helpers/vCalendarDragAndDrop.js'
8994
import { errorToMultiLineToast } from '@/components/toast/toasts'
9095
import PicassoEntry from './PicassoEntry.vue'
96+
import { campRoleMixin } from '@/mixins/campRoleMixin.js'
9197
9298
export default {
9399
name: 'Picasso',
94100
components: {
95101
PicassoEntry,
96102
DayResponsibles,
97103
},
104+
mixins: [campRoleMixin],
98105
props: {
99106
// period for which to show picasso
100107
period: {

frontend/src/mixins/campRoleMixin.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ export const campRoleMixin = {
1212
isMember() {
1313
return this.role === 'member'
1414
},
15+
isOutsider() {
16+
return !this.role
17+
},
1518
role() {
1619
const currentUserLink = this.$store.getters.getLoggedInUser?._meta.self
1720
const result = this._campCollaborations
@@ -22,8 +25,10 @@ export const campRoleMixin = {
2225
return result?.role
2326
},
2427
_campCollaborations() {
25-
const campCollaborations = this._camp?.campCollaborations()
26-
return campCollaborations?.items
28+
if (typeof this.camp.campCollaborations !== 'function') {
29+
return []
30+
}
31+
return this._camp?.campCollaborations()?.items
2732
},
2833
_camp() {
2934
if (typeof this.camp === 'function') {

frontend/src/views/camp/CampProgram.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Show all activity schedule entries of a single period.
4444
/>
4545
<v-menu offset-y>
4646
<template #activator="{ on, attrs }">
47-
<v-btn icon v-bind="attrs" v-on="on" data-testid="campprogram-menu">
47+
<v-btn icon v-bind="attrs" data-testid="campprogram-menu" v-on="on">
4848
<v-badge
4949
v-if="!$vuetify.breakpoint.smAndUp && filteredPropertiesCount > 0"
5050
overlap
@@ -91,6 +91,8 @@ Show all activity schedule entries of a single period.
9191
:loading-endpoints="loadingEndpoints"
9292
:camp="camp"
9393
:filter-fn="filterFn"
94+
:hide-self-filter="isOutsider"
95+
:hide-collaborator-filter="isOutsider"
9496
hide-period-filter
9597
hide-day-filter
9698
@height-changed="scheduleEntryFiltersHeightChanged"

frontend/src/views/camp/Dashboard.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
class="ma-4"
1515
:loading-endpoints="true"
1616
:camp="camp"
17+
:hide-self-filter="isOutsider"
18+
:hide-collaborator-filter="isOutsider"
1719
hide-day-filter
1820
:periods="periods"
1921
/>
@@ -25,6 +27,8 @@
2527
:loading-endpoints="loadingEndpoints"
2628
:camp="camp"
2729
:periods="periods"
30+
:hide-self-filter="isOutsider"
31+
:hide-collaborator-filter="isOutsider"
2832
hide-day-filter
2933
:filter-fn="filterFn"
3034
/>
@@ -153,6 +157,7 @@ import AvatarRow from '@/components/generic/AvatarRow.vue'
153157
import ScheduleEntryFilters from '@/components/program/ScheduleEntryFilters.vue'
154158
import dayjs from '@/common/helpers/dayjs.js'
155159
import { filterMatchScheduleEntry } from '@/common/helpers/filterMatchScheduleEntry.js'
160+
import { campRoleMixin } from '../../mixins/campRoleMixin.js'
156161
157162
export default {
158163
name: 'Dashboard',
@@ -162,7 +167,7 @@ export default {
162167
ActivityRow,
163168
ContentCard,
164169
},
165-
mixins: [dateHelperUTCFormatted],
170+
mixins: [dateHelperUTCFormatted, campRoleMixin],
166171
props: {
167172
camp: { type: Object, required: true },
168173
},

frontend/src/views/camp/admin/SideBarAdmin.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
icon="mdi-view-dashboard-outline"
1414
/>
1515
<SidebarListItem
16+
v-if="!isOutsider"
1617
:to="adminRoute(camp, 'collaborators')"
1718
:title="$tc('views.camp.admin.sideBarAdmin.itemCollaborators')"
1819
icon="mdi-account-group-outline"
@@ -24,6 +25,7 @@
2425
icon="mdi-clipboard-list-outline"
2526
/>
2627
<SidebarListItem
28+
v-if="!isOutsider"
2729
:to="adminRoute(camp, 'material')"
2830
:title="$tc('views.camp.admin.sideBarAdmin.itemMaterialLists')"
2931
icon="mdi-package-variant-closed"

frontend/src/views/camp/navigation/desktop/NavTopbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<span class="blue-grey--text"><v-icon small right>mdi-open-in-new</v-icon></span>
4646
</v-btn>
4747
</v-toolbar-items>
48-
<UserMeta :camp="camp" />
48+
<UserMeta :camp="isOutsider ? null : camp" />
4949
</v-app-bar>
5050
</template>
5151

0 commit comments

Comments
 (0)