Skip to content

Commit aab7bb2

Browse files
committed
Merged in stage (pull request #28)
release 0.6.0
2 parents 01d0413 + e42b9d0 commit aab7bb2

File tree

6 files changed

+80
-12
lines changed

6 files changed

+80
-12
lines changed

django/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ migrate:
3232
$(DOCKER_EXEC) python3 manage.py migrate
3333
make collectstatic
3434

35+
createcachetable:
36+
$(DOCKER_EXEC) python3 manage.py createcachetable
37+
3538
tests:
3639
$(DOCKER_EXEC) pytest --create-db
3740

@@ -50,5 +53,6 @@ import-gemeinden-json:
5053
init:
5154
make symlinks
5255
make migrate
56+
make createcachetable
5357
make adminuser
5458
make import-gemeinden-json

django/gsmap/models.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from django.core.files.base import ContentFile
1616
from django.core.files.storage import FileSystemStorage
1717
from django.utils.html import escape
18+
from django.db import transaction, DatabaseError
1819
from sortedm2m.fields import SortedManyToManyField
1920
from sorl.thumbnail import ImageField, get_thumbnail
2021
from gsuser.models import User
@@ -241,12 +242,18 @@ def test_exists(pk):
241242
else:
242243
storage.delete(f'snapshot-meta/{self.id}.html')
243244

244-
super().save(*args, **kwargs)
245+
try:
246+
super().save(*args, **kwargs)
247+
except DatabaseError:
248+
transaction.rollback()
245249

246250
if hasattr(settings, 'SAVE_SCREENSHOT_ENABLED') and settings.SAVE_SCREENSHOT_ENABLED is True:
247251
self.create_screenshot()
248252

249-
super().save(*args, **kwargs)
253+
try:
254+
super().save(*args, **kwargs)
255+
except DatabaseError:
256+
transaction.rollback()
250257

251258
def create_screenshot(self):
252259
# only create snapshot if data changed

vue/src/assets/styles/main.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,14 @@ a {
8787
padding-bottom: 6em;
8888
}
8989

90+
.v-btn.nobg::before{
91+
content: none;
92+
}
93+
.v-btn.nobg .v-icon{
94+
transition: color 0.3s;
95+
}
96+
.v-btn.nobg:hover .v-icon{
97+
color: #543076 !important;
98+
}
99+
90100
/* SNAPSHOTS END */

vue/src/components/SnapshotList.vue

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,61 @@
1212
<template>
1313
<v-list class="snapshotlist"
1414
three-line>
15+
<div v-for="(snapshot, index) in groupedsnapshots" :key="snapshot.id">
16+
<v-subheader
17+
v-if="showTopic(index) && withTopic"
18+
class="px-0">{{ snapshot.topic }}</v-subheader>
19+
<v-list-item class="px-0 mb-4" dense
1520

16-
<v-list-item class="px-2 mb-4" dense
17-
v-for="snapshot in snapshots" :key="snapshot.id"
1821
:to="createRouteLink(snapshot.pk)">
19-
<v-list-item-avatar tile size="64" class="my-2">
22+
<v-list-item-avatar tile size="64" class="my-0">
2023
<v-img
2124
v-if="snapshot.thumbnail"
2225
:src="djangobaseurl + '/media/' + snapshot.thumbnail">
2326
</v-img>
2427
</v-list-item-avatar>
2528
<v-list-item-content>
2629
<v-list-item-title style="font-weight:700">{{ snapshot.title }}</v-list-item-title>
27-
<v-list-item-subtitle>{{ snapshot.topic }}</v-list-item-subtitle>
2830
</v-list-item-content>
29-
<v-list-item-action style="margin:0 0 4px 0; align-self: flex-end;">
31+
<v-list-item-action style="margin:0 0 4px 0; align-self: center;">
3032
<v-btn icon
33+
class="nobg"
3134
v-if="snapshot.screenshot"
3235
v-on:click.stop="function(){}"
3336
:href="djangobaseurl + '/downloads/' + snapshot.screenshot">
3437
<v-icon color="grey lighten-1" >mdi-download</v-icon>
3538
</v-btn>
3639
</v-list-item-action>
3740
</v-list-item>
41+
</div>
3842
</v-list>
3943
</template>
4044

4145
<style>
4246
.snapshotlist .v-list-item {
4347
background-color: #f8f8f8;
4448
border-radius: 4px;
49+
overflow: hidden;
4550
}
4651
.snapshotlist .v-list-item,
4752
.snapshotlist .v-list-item__content {
48-
min-height: 80px;
53+
min-height: 64px;
4954
}
55+
5056
.snapshotlist .v-list-item--active::before {
51-
background-color: transparent;
57+
background-color: #543076;
5258
border: 1px solid #000;
5359
border-radius: 4px;
5460
}
61+
62+
.v-list-item__title {
63+
display: -webkit-box;
64+
-webkit-box-orient: vertical;
65+
-webkit-line-clamp: 3;
66+
overflow: hidden;
67+
white-space: initial;
68+
text-overflow: ellipsis;
69+
}
5570
</style>
5671

5772

@@ -60,7 +75,8 @@ export default {
6075
name: 'SnapshotList',
6176
data() {
6277
return {
63-
djangobaseurl: process.env.VUE_APP_DJANGOBASEURL
78+
djangobaseurl: process.env.VUE_APP_DJANGOBASEURL,
79+
groupedsnapshots: []
6480
};
6581
},
6682
@@ -69,7 +85,11 @@ export default {
6985
type: String,
7086
default: ''
7187
},
72-
snapshots: Array
88+
snapshots: Array,
89+
withTopic: {
90+
type: Boolean,
91+
default: true
92+
}
7393
},
7494
7595
methods: {
@@ -78,6 +98,32 @@ export default {
7898
return `/${this.$i18n.locale}/${this.workspaceHash}/${hash}/`;
7999
}
80100
return `/${this.$i18n.locale}/${hash}/`;
101+
},
102+
showTopic(curindex) {
103+
if (curindex > 0) {
104+
if (this.groupedsnapshots[curindex - 1].topic !== this.groupedsnapshots[curindex].topic) {
105+
return true;
106+
}
107+
return false;
108+
}
109+
return true;
110+
}
111+
},
112+
watch: {
113+
snapshots(newsnaps) {
114+
const topicgroups = {};
115+
newsnaps.forEach((snapshot) => {
116+
if (typeof (topicgroups[snapshot.topic]) === 'undefined') {
117+
topicgroups[snapshot.topic] = [];
118+
}
119+
topicgroups[snapshot.topic].push(snapshot);
120+
});
121+
122+
Object.keys(topicgroups).forEach((group) => {
123+
topicgroups[group].forEach((snapshot) => {
124+
this.groupedsnapshots.push(snapshot);
125+
});
126+
});
81127
}
82128
}
83129
};

vue/src/components/SnapshotMap.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ body,
6262
position: relative;
6363
width: 100%;
6464
overflow: hidden;
65+
background: #dedede;
6566
}
6667
6768
#map .mapbox-improve-map {

vue/src/views/Snapshot.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
<snapshot-list
6868
v-if="snapshotsExamples"
69-
:snapshots="snapshotsExamples"
69+
:snapshots="snapshotsExamples" :withTopic="false"
7070
/>
7171

7272
<div class="useractions">

0 commit comments

Comments
 (0)