Skip to content

Commit 2b06dad

Browse files
authored
Merge branch 'main' into circle-clickable
2 parents 778dc9b + 5f3d7f4 commit 2b06dad

File tree

13 files changed

+210
-40
lines changed

13 files changed

+210
-40
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DOCKER_EXEC_VUE=$(shell command -v docker > /dev/null && echo "docker-compose ex
55
DOCKER_EXEC_WWW=$(shell command -v docker > /dev/null && echo "docker-compose exec $(NOTTY) www")
66

77

8-
.PHONY: tests
8+
.PHONY: deploy_version
99

1010
init:
1111
cd django && make init
@@ -87,3 +87,9 @@ import-db:
8787
tests:
8888
cd django && make tests
8989
cd vue && make tests
90+
91+
deploy_version:
92+
bash -c 'printf "%s\t%s" "$$(git describe --abbrev=0 --tags)" "$$(git rev-parse --short HEAD)" > django/VERSION'
93+
cp django/VERSION vue/VERSION
94+
95+
-include deploy_version

django/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
tmp
2+
VERSION

django/gsmap/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Meta:
115115
permission = models.IntegerField(
116116
choices=[(perm.value, perm.name)
117117
for perm in SnapshotPermission],
118-
default=SnapshotPermission.PUBLIC
118+
default=SnapshotPermission.NOT_LISTED
119119
)
120120

121121
title = models.CharField(max_length=150, default='')

django/main/settings.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import os.path
23

34
# use your own secret_key, default for testing and dev
45
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY') or os.getenv('DJANGO_SECRET_KEY_DEV')
@@ -20,6 +21,18 @@
2021
ADMIN_HEADER_COLOR = os.environ.get('DJANGO_ADMIN_HEADER_COLOR', '#543076')
2122
LOGIN_PAGE_TITLE = os.environ.get('LOGIN_PAGE_TITLE', 'Gemeindescan')
2223

24+
CURRENT_TAG_VERSION = "NaN.NaN.NaN"
25+
CURRENT_COMMIT_VERSION = "NaN"
26+
27+
if os.path.isfile("VERSION"):
28+
with open("VERSION", 'r') as f:
29+
try:
30+
content = f.read().split("\t")
31+
CURRENT_TAG_VERSION = content[0]
32+
CURRENT_COMMIT_VERSION = content[1]
33+
except:
34+
pass
35+
2336
if os.environ.get('DJANGO_ALLOWED_HOSTS'):
2437
ALLOWED_HOSTS = os.environ.get('DJANGO_ALLOWED_HOSTS', '').split(',')
2538
SITE_ID = 1
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{% load i18n static %}<!DOCTYPE html>
2+
{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
3+
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" dir="{{ LANGUAGE_BIDI|yesno:'rtl,ltr,auto' }}">
4+
<head>
5+
<title>{% block title %}{% endblock %}</title>
6+
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% static "admin/css/base.css" %}{% endblock %}">
7+
{% if not is_popup and is_nav_sidebar_enabled %}
8+
<link rel="stylesheet" type="text/css" href="{% static "admin/css/nav_sidebar.css" %}">
9+
<script src="{% static 'admin/js/nav_sidebar.js' %}" defer></script>
10+
{% endif %}
11+
{% block extrastyle %}{% endblock %}
12+
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% static "admin/css/rtl.css" %}{% endblock %}">{% endif %}
13+
{% block extrahead %}{% endblock %}
14+
{% block responsive %}
15+
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
16+
<link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive.css" %}">
17+
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive_rtl.css" %}">{% endif %}
18+
{% endblock %}
19+
{% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE">{% endblock %}
20+
</head>
21+
22+
<body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}"
23+
data-admin-utc-offset="{% now "Z" %}">
24+
25+
<!-- Container -->
26+
<div id="container">
27+
28+
{% if not is_popup %}
29+
<!-- Header -->
30+
{% block header %}
31+
<div id="header">
32+
<div id="branding">
33+
{% block branding %}{% endblock %}
34+
</div>
35+
{% block usertools %}
36+
{% if has_permission %}
37+
<div id="user-tools">
38+
{% block welcome-msg %}
39+
{% translate 'Welcome,' %}
40+
<strong>{% firstof user.get_short_name user.get_username %}</strong>.
41+
{% endblock %}
42+
{% block userlinks %}
43+
{% if site_url %}
44+
<a href="{{ site_url }}">{% translate 'View site' %}</a> /
45+
{% endif %}
46+
{% if user.is_active and user.is_staff %}
47+
{% url 'django-admindocs-docroot' as docsroot %}
48+
{% if docsroot %}
49+
<a href="{{ docsroot }}">{% translate 'Documentation' %}</a> /
50+
{% endif %}
51+
{% endif %}
52+
{% if user.has_usable_password %}
53+
<a href="{% url 'admin:password_change' %}">{% translate 'Change password' %}</a> /
54+
{% endif %}
55+
<a href="{% url 'admin:logout' %}">{% translate 'Log out' %}</a>
56+
{% endblock %}
57+
</div>
58+
{% endif %}
59+
{% endblock %}
60+
{% block nav-global %}{% endblock %}
61+
</div>
62+
{% endblock %}
63+
<!-- END Header -->
64+
{% block breadcrumbs %}
65+
<div class="breadcrumbs">
66+
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
67+
{% if title %} &rsaquo; {{ title }}{% endif %}
68+
</div>
69+
{% endblock %}
70+
{% endif %}
71+
72+
<div class="main" id="main">
73+
{% if not is_popup and is_nav_sidebar_enabled %}
74+
{% block nav-sidebar %}
75+
{% include "admin/nav_sidebar.html" %}
76+
{% endblock %}
77+
{% endif %}
78+
<div class="content">
79+
{% block messages %}
80+
{% if messages %}
81+
<ul class="messagelist">{% for message in messages %}
82+
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message|capfirst }}</li>
83+
{% endfor %}</ul>
84+
{% endif %}
85+
{% endblock messages %}
86+
<!-- Content -->
87+
<div id="content" class="{% block coltype %}colM{% endblock %}">
88+
{% block pretitle %}{% endblock %}
89+
{% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
90+
{% block content_subtitle %}{% if subtitle %}<h2>{{ subtitle }}</h2>{% endif %}{% endblock %}
91+
{% block content %}
92+
{% block object-tools %}{% endblock %}
93+
{{ content }}
94+
{% endblock %}
95+
{% block sidebar %}{% endblock %}
96+
<br class="clear">
97+
</div>
98+
<!-- END Content -->
99+
{% block footer %}<div id="footer"></div>{% endblock %}
100+
</div>
101+
</div>
102+
</div>
103+
<!-- END Container -->
104+
<footer>
105+
<a target="_blank" href="https://github.com/cividi/spatial-data-package-platform/releases/tag/{{CURRENT_TAG_VERSION}}">v{{CURRENT_TAG_VERSION}}</a>
106+
&nbsp;
107+
(<a target="_blank" href="https://github.com/cividi/spatial-data-package-platform/commit/{{CURRENT_COMMIT_VERSION}}">{{CURRENT_COMMIT_VERSION}}</a>)
108+
</footer>
109+
</body>
110+
</html>

django/main/templates/admin/base_site.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,33 @@
6464
.object-tools a:focus, .object-tools a:hover {
6565
background-color: #543076;
6666
}
67+
body {
68+
height: auto;
69+
min-height: calc(100vh - 35px);
70+
}
71+
body #container {
72+
height: auto;
73+
min-height: calc(100vh - 35px);
74+
}
75+
footer {
76+
height: 35px;
77+
text-align: center;
78+
color: white;
79+
font-weight: bold;
80+
background-color: {{ ADMIN_HEADER_COLOR }};
81+
display: flex;
82+
justify-content: center;
83+
align-items: center;
84+
font-weight: 300;
85+
}
86+
footer a,
87+
footer a:focus,
88+
footer a:link,
89+
footer a:visited {
90+
color: white;
91+
}
92+
footer a:hover{
93+
font-weight: 900;
94+
}
6795
</style>
6896
{% endblock %}

django/main/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ def context_processor(request):
1919
return {
2020
'ADMIN_HEADER_COLOR': settings.ADMIN_HEADER_COLOR,
2121
'LOGIN_PAGE_TITLE': settings.LOGIN_PAGE_TITLE,
22+
'CURRENT_TAG_VERSION': settings.CURRENT_TAG_VERSION,
23+
'CURRENT_COMMIT_VERSION': settings.CURRENT_COMMIT_VERSION
2224
}

vue/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ yarn-error.log*
1919
*.njsproj
2020
*.sln
2121
*.sw?
22+
23+
VERSION

vue/src/components/SnapshotMap.vue

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
<!-- eslint-disable -->
2-
<i18n>
3-
{
4-
"de": {
5-
"map": "Karte"
6-
},
7-
"fr": {
8-
"map": "Carte"
9-
}
10-
}
11-
</i18n>
12-
<!-- eslint-enable -->
13-
141
<template>
152
<v-main>
163
<v-slide-x-reverse-transition>
@@ -31,7 +18,7 @@
3118
<v-btn
3219
v-if="hash && !screenshotIsThumbnail"
3320
fab absolute small
34-
style="bottom:2em; right:2em;"
21+
style="bottom:2.5em; right:2em;"
3522
color="white"
3623
@click="mapinfoopen=!mapinfoopen">
3724
<v-icon>mdi-information-variant</v-icon>
@@ -59,15 +46,6 @@
5946
:sources="sources"
6047
/>
6148
</v-card>
62-
63-
<p
64-
v-if="!hash"
65-
id="mapattribution"
66-
class="small mb-0"
67-
>
68-
<a href="https://www.openstreetmap.org/copyright" target="_blank">{{ $t('map') }}: Mapbox, © OpenStreetMap</a>
69-
</p>
70-
7149
</v-main>
7250
</template>
7351

@@ -106,13 +84,9 @@ body,
10684
animation: none;
10785
}
10886
109-
#map .mapbox-improve-map {
110-
display: none;
111-
}
112-
11387
#mapinfo {
11488
position: absolute;
115-
bottom: 2em;
89+
bottom: 2.5em;
11690
right: 2em;
11791
min-width: 240px;
11892
clip-path: circle(0% at 95% 90%);
@@ -125,15 +99,7 @@ body,
12599
pointer-events: auto;
126100
clip-path: circle(100% at center);
127101
}
128-
#mapattribution {
129-
position: absolute;
130-
bottom: 0.5em;
131-
right: 1em;
132-
}
133102
134-
.mapbox-improve-map {
135-
display: none;
136-
}
137103
</style>
138104

139105
<script>
@@ -317,9 +283,10 @@ export default {
317283
if (this.screenshotMode) {
318284
// no zoom controls in screenshot mode
319285
document.querySelector('.leaflet-control-zoom').style.display = 'none';
320-
} else {
321-
// no attribution in normal mode
322286
document.querySelector('.leaflet-control-attribution').style.display = 'none';
287+
} else if (this.hash) {
288+
// no attribution in normal mode
289+
document.querySelector('.leaflet-control-attribution').style.background = 'none';
323290
}
324291
if (this.screenshotIsThumbnail) {
325292
document.querySelector('#mapinfo').style.visibility = 'hidden';

vue/src/components/Version.vue

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<template>
2+
<div class="version">
3+
<a target="_blank" :href="'https://github.com/cividi/spatial-data-package-platform/releases/tag/' + version[0]">v{{version[0]}}</a>
4+
&nbsp;
5+
(<a target="_blank" :href="'https://github.com/cividi/spatial-data-package-platform/commit/' + version[1]">{{version[1]}}</a>)
6+
</div>
7+
</template>
8+
9+
<script>
10+
export default {
11+
name: 'Version',
12+
data() {
13+
return {
14+
version: process.env.VUE_APP_GIT_VERSION.split('\t')
15+
};
16+
}
17+
};
18+
</script>
19+
20+
<style>
21+
.version {
22+
height: 35px;
23+
text-align: center;
24+
}
25+
</style>

0 commit comments

Comments
 (0)