Skip to content

Commit e56cb7f

Browse files
committed
added municipality snapshots,
1 parent 07315dc commit e56cb7f

File tree

4 files changed

+67
-18
lines changed

4 files changed

+67
-18
lines changed

vue/src/components/SnapshotList.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
three-line>
1515

1616
<v-subheader
17+
v-if="snapshots.length != 0 && title"
1718
style="color:black;font-weight:700;"
18-
class="px-0">{{ listtitle }}
19+
class="px-0">{{ title }}
1920
</v-subheader>
2021

21-
<v-list-item v-for="snapshot in snapshots" :key="snapshot.id"
22-
:to="createRouteLink(snapshot.pk)"
23-
class="px-2 mb-4" dense>
22+
<v-list-item class="px-2 mb-4" dense
23+
v-for="snapshot in snapshots" :key="snapshot.id"
24+
:to="createRouteLink(snapshot.pk)">
2425
<v-list-item-avatar tile size="64" class="my-2">
2526
<v-img :src="djangobaseurl + snapshot.screenshot.url"></v-img>
2627
</v-list-item-avatar>
@@ -64,7 +65,10 @@ export default {
6465
default: ''
6566
},
6667
snapshots: Array,
67-
listtitle: String
68+
title: {
69+
type: String,
70+
default: ''
71+
}
6872
},
6973
7074
methods: {

vue/src/router/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const routes = [
107107
{
108108
path: ':wshash([0-9A-Z]{5})/:hash([0-9A-Z]{6})/',
109109
pathToRegexpOptions: { sensitive: true, strict: true },
110-
name: 'workspace',
110+
name: 'workspaceRedirect',
111111
component: () => import('@/views/Workspace.vue'),
112112
meta: {
113113
layout: () => import('@/layouts/LayoutSnapshot.vue')

vue/src/views/Snapshot.vue

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"noSnapshot.municipalityText": "diese Gemeinde",
1111
"noSnapshot.p1": "Für {municipalityText} stehen zur Zeit noch keine Daten zur Verfügung.",
1212
"noSnapshot.p2": "Erkunden Sie unsere Fallbeispiele um ein besseres Bild der Möglichkeiten für Ihre Gemeinde zu erhalten.",
13-
"listtitle": "Fallbeispiele"
13+
"listtitle": "Fallbeispiele",
14+
"listtitleMore": "Weitere Fallbeispiele"
1415
},
1516
"fr": {
1617
"calltoactionText": "Offre pour votre commune",
@@ -21,7 +22,8 @@
2122
"noSnapshot.municipalityText": "cette communauté",
2223
"noSnapshot.p1": "En ce moment il n’éxiste pas encore de données pour {municipalityText}.",
2324
"noSnapshot.p2": "Prenez compte de nos études pour une meilleure vue d’ensemble des possibilitiées qui s’offrent à votre commune.",
24-
"listtitle": "Examples"
25+
"listtitle": "Examples",
26+
"listtitleMore": "D'autres examples"
2527
}
2628
}
2729
</i18n>
@@ -62,12 +64,17 @@
6264
</router-link>
6365
</v-btn>
6466
</div>
67+
68+
<snapshot-list
69+
v-if="snapshotsMunicipality"
70+
:snapshots="snapshotsMunicipality"
71+
/>
6572
</div>
6673

6774
<snapshot-list
75+
v-if="snapshotsExamples"
6876
:snapshots="snapshotsExamples"
69-
:pushRoute="true"
70-
:listtitle="this.$t('listtitle')"
77+
:title="listtitleText"
7178
/>
7279
</div>
7380

@@ -124,7 +131,9 @@ export default {
124131
geojson: null,
125132
geobounds: [],
126133
municipalityName: '',
127-
snapshotsExamples: []
134+
snapshotsExamples: [],
135+
snapshotsIdExamplesExclude: [],
136+
snapshotsMunicipality: []
128137
};
129138
},
130139
@@ -153,6 +162,13 @@ export default {
153162
154163
municipalityText() {
155164
return this.municipalityName ? this.municipalityName : this.$t('noSnapshot.municipalityText');
165+
},
166+
167+
listtitleText() {
168+
if (this.snapshotsMunicipality.length > 0) {
169+
return this.$t('listtitleMore');
170+
}
171+
return this.$t('listtitle');
156172
}
157173
},
158174
@@ -167,6 +183,15 @@ export default {
167183
municipality {
168184
bfsNumber
169185
fullname
186+
snapshots {
187+
id
188+
pk
189+
title
190+
topic
191+
screenshot {
192+
url
193+
}
194+
}
170195
}
171196
}
172197
@@ -191,7 +216,12 @@ export default {
191216
if (result.data.hasOwnProperty('snapshot') && result.data.snapshot) {
192217
this.geojson = result.data.snapshot.data;
193218
this.municipalityName = result.data.snapshot.municipality.fullname;
194-
this.snapshotsExamples = result.data.snapshots.edges.map(snapshot => snapshot.node);
219+
this.snapshotsMunicipality = result.data.snapshot.municipality.snapshots;
220+
const snapshotsIdExamplesExclude = this.snapshotsMunicipality.map(snapshot => snapshot.id);
221+
this.snapshotsExamples = result.data.snapshots.edges.map(snapshot => snapshot.node).filter(
222+
snapshot => !snapshotsIdExamplesExclude.includes(snapshot.id)
223+
);
224+
195225
this.$store.commit('setBfsnumber', result.data.snapshot.municipality.bfsNumber);
196226
this.$store.commit('setBfsname', result.data.snapshot.municipality.fullname);
197227
} else {
@@ -208,8 +238,18 @@ export default {
208238
fullname
209239
perimeter
210240
perimeterBounds
241+
snapshots {
242+
id
243+
pk
244+
title
245+
topic
246+
screenshot {
247+
url
248+
}
249+
}
211250
}
212-
snapshots {
251+
252+
snapshots(isShowcase: true) {
213253
edges {
214254
node {
215255
id
@@ -230,7 +270,7 @@ export default {
230270
this.municipalityName = result.data.municipality.fullname;
231271
this.geojson = result.data.municipality.perimeter;
232272
this.geobounds = result.data.municipality.perimeterBounds;
233-
this.snapshotsExamples = result.data.snapshots.edges;
273+
this.snapshotsExamples = result.data.snapshots.edges.map(snapshot => snapshot.node);
234274
this.$store.commit('setBfsnumber', result.data.municipality.bfsNumber);
235275
this.$store.commit('setBfsname', result.data.municipality.fullname);
236276
}

vue/src/views/Workspace.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
<i18n>
33
{
44
"de": {
5-
"listtitle": "Scans"
65
},
76
"fr": {
8-
"listtitle": "Scans"
97
}
108
}
119
</i18n>
@@ -37,7 +35,6 @@
3735

3836
<snapshot-list
3937
:snapshots="snapshotsWorkspace"
40-
:listtitle="$t('listtitle')"
4138
:workspaceHash="wshash"
4239
/>
4340
</div>
@@ -128,7 +125,6 @@ export default {
128125
pk
129126
title
130127
description
131-
132128
snapshots {
133129
id
134130
pk
@@ -147,6 +143,15 @@ export default {
147143
municipality {
148144
bfsNumber
149145
fullname
146+
snapshots {
147+
id
148+
pk
149+
title
150+
topic
151+
screenshot {
152+
url
153+
}
154+
}
150155
}
151156
}
152157
}`,

0 commit comments

Comments
 (0)