-
Notifications
You must be signed in to change notification settings - Fork 6
/
credits.vue
205 lines (194 loc) · 5.27 KB
/
credits.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<template>
<div
data-qa="exhibition credits page"
class="text-page white-page"
>
<!-- TODO: use the AuthoredHead component here, so it matches the exhibition chapters -->
<b-container
class="footer-margin"
>
<b-row class="justify-content-center">
<b-col
cols="12"
class="col-lg-8 pt-large mb-4"
>
<div
class="context-label"
>
{{ $tc('exhibitions.exhibitions', 1) }}
</div>
<h2
v-if="exhibitionTitle"
class="subtitle"
>
{{ exhibitionTitle }}
</h2>
<h1>{{ $t('exhibitions.credits') }}</h1>
</b-col>
</b-row>
<b-row class="justify-content-center">
<b-col
cols="12"
class="col-lg-8 mb-3"
>
<article>
<ShareButton class="mb-4" />
<ShareSocialModal />
<!-- eslint-disable vue/no-v-html -->
<div
data-qa="credits text"
v-html="htmlCredits"
/>
<!-- eslint-enable vue/no-v-html -->
</article>
</b-col>
</b-row>
<client-only>
<b-row
v-if="hasPartCollection"
class="justify-content-center"
>
<b-col
cols="12"
class="mt-3 col-lg-8"
>
<LinkList
:items="chapterPagesToLinkListItems(hasPartCollection.items, identifier)"
:title="$t('exhibitions.chapters')"
/>
</b-col>
</b-row>
<b-row
v-if="relatedLink"
class="related-container justify-content-center"
>
<b-col
cols="12"
class="col-lg-8"
>
<EntityBadges
:entity-uris="relatedLink"
/>
</b-col>
</b-row>
<b-row
v-if="genre"
class="related-container justify-content-center"
>
<b-col
cols="12"
class="col-lg-8"
>
<ThemeBadges
:themes-identifiers="genre"
/>
</b-col>
</b-row>
</client-only>
</b-container>
</div>
</template>
<script>
import ClientOnly from 'vue-client-only';
import { marked } from 'marked';
import ShareSocialModal from '../../../components/share/ShareSocialModal.vue';
import ShareButton from '../../../components/share/ShareButton.vue';
import exhibitionChapters from '../../../mixins/exhibitionChapters';
import pageMetaMixin from '@/mixins/pageMeta';
import logEventMixin from '@/mixins/logEvent';
export default {
name: 'ExhibitionCreditsPage',
components: {
ClientOnly,
EntityBadges: () => import('@/components/entity/EntityBadges'),
LinkList: () => import('../../../components/generic/LinkList'),
ShareButton,
ShareSocialModal,
ThemeBadges: () => import('@/components/theme/ThemeBadges')
},
mixins: [
exhibitionChapters,
logEventMixin,
pageMetaMixin
],
beforeRouteLeave(to, from, next) {
this.$store.commit('breadcrumb/clearBreadcrumb');
next();
},
asyncData({ params, query, error, app, store }) {
const variables = {
identifier: params.exhibition,
locale: app.i18n.isoLocale(),
preview: query.mode === 'preview'
};
return app.$contentful.query('exhibitionCreditsPage', variables)
.then(response => response.data.data)
.then(data => {
if (data.exhibitionPageCollection.items.length === 0) {
error({ statusCode: 404, message: app.i18n.t('messages.notFound') });
return null;
}
const exhibition = data.exhibitionPageCollection.items[0];
store.commit('breadcrumb/setBreadcrumbs', [
{
text: app.i18n.tc('exhibitions.exhibitions', 2),
to: app.localePath({ name: 'exhibitions' })
},
{
text: exhibition.name,
to: app.localePath({
name: 'exhibitions-exhibition',
params: {
exhibition: exhibition.identifier
}
})
},
{
text: app.i18n.t('exhibitions.credits'),
active: true
}
]);
return exhibition;
})
.catch((e) => {
error({ statusCode: 500, message: e.toString() });
});
},
data() {
return {
name: null,
identifier: null,
credits: '',
relatedLink: null,
hasPartCollection: null,
genre: null
};
},
computed: {
pageMeta() {
return {
title: `${this.name} - ${this.$t('exhibitions.credits')}`,
ogType: 'article'
};
},
htmlCredits() {
if (this.credits === undefined) {
return false;
}
return marked.parse(this.credits);
},
exhibitionTitle() {
return this.name;
}
},
mounted() {
this.logEvent('view', `${this.$config.app.baseUrl}/exhibitions/${this.identifier}`);
}
};
</script>
<style lang="scss" scoped>
::v-deep img {
display: block;
margin: 1rem 0;
}
</style>