Skip to content

Commit

Permalink
- Add client_version (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
marthamareal authored May 25, 2021
1 parent 98383f4 commit 38a00c3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load static %}
{% load client_version %}

{% include '../_geonode_config.html' with is_embed=is_embed is_app=True plugins_config_key=plugins_config_key|default:'geostory' is_new_resource=is_new|default:'true' %}
<script id="ms2-api" src="{% static 'mapstore/dist/gn-geostory.js' %}"></script>
<script id="ms2-api" src="{% static 'mapstore/dist/gn-geostory.js' %}?{% client_version %}"></script>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load static from staticfiles %}
{% load client_lib_tags %}
{% load client_version %}
<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -96,6 +97,6 @@
</div>
</div>
</div>
<script id="gn-script" src="/static/mapstore/dist/gn-map.js"></script>
<script id="gn-script" src="{% static 'mapstore/dist/gn-map.js' %}?{% client_version %}"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

{% load static %}
{% load client_version %}
<style>
.gn-main-loader-container {
position: absolute;
Expand Down Expand Up @@ -85,5 +86,5 @@
</div>
</div>
</div>
<script id="gn-script" src="/static/mapstore/dist/gn-map.js"></script>
<script id="gn-script" src="{% static 'mapstore/dist/gn-map.js' %}?{% client_version %}"></script>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load static from staticfiles %}
{% load client_lib_tags %}
{% load client_version %}
<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -90,6 +91,6 @@
</div>
</div>
</div>
<script id="gn-script" src="/static/mapstore/dist/gn-map.js"></script>
<script id="gn-script" src="{% static 'mapstore/dist/gn-map.js' %}?{% client_version %}"></script>
</body>
</html>
Empty file.
23 changes: 23 additions & 0 deletions geonode_mapstore_client/templatetags/client_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
import logging

from django import template
from django.conf import settings

logger = logging.getLogger(__name__)
register = template.Library()


@register.simple_tag
def client_version():
try:
file_path = os.path.join(
settings.STATIC_ROOT,
'mapstore/version.txt'
)
with open(file_path, 'r') as f:
version = f.read()
return version
except Exception as e:
logger.error(e)
return ''

0 comments on commit 38a00c3

Please sign in to comment.