Skip to content

Commit

Permalink
Merge pull request #213 from sumandari/versioning
Browse files Browse the repository at this point in the history
Add version release in template
  • Loading branch information
sumandari authored Nov 9, 2021
2 parents a6f4c6d + ae6b4e4 commit 6398ab4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
1 change: 1 addition & 0 deletions qgis-app/.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
17 changes: 17 additions & 0 deletions qgis-app/models/templatetags/resources_custom_tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os.path

import markdown

from django import template
from django.conf import settings
from django.forms import CheckboxInput
from django.utils.safestring import mark_safe

Expand Down Expand Up @@ -57,3 +60,17 @@ def md_to_html(md_string):
md = markdown.Markdown()
html = md.convert(md_string)
return mark_safe(html)


# inspired by projecta <https://github.com/kartoza/prj.app>
@register.simple_tag(takes_context=True)
def version_tag(context):
"""Reads current project release from the .version file."""
version_file = os.path.join(settings.SITE_ROOT, '.version')
try:
with open(version_file, 'r') as file:
version = file.read()
context['version'] = version
except IOError:
context['version'] = 'Unknown'
return context['version']
3 changes: 2 additions & 1 deletion qgis-app/plugins/templates/plugins/plugin_base.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends BASE_TEMPLATE %}{% load i18n plugins_tagcloud static %}
{% load resources_custom_tags %}
{% block extratitle %}{% trans "Python Plugins Repository"%}{% endblock %}
{% block app_title %}
<h2>{% trans "QGIS Python Plugins Repository"%}</h2>
Expand Down Expand Up @@ -40,5 +41,5 @@ <h3>{% trans "Plugin tags" %}</h3>
{% endblock %}

{% block "credits" %}
{% trans "This web application was developed by:" %}&nbsp;<a href="https://www.itopen.it">Alessandro Pasotti</a> and &nbsp;<a href="https://kartoza.com"><img src="{% static 'images/kartoza-logo-only.png' %}" alt="Kartoza icon" width="16" height="16">Kartoza</a>.
{{ block.super }}
{% endblock %}
13 changes: 7 additions & 6 deletions qgis-app/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% load i18n simplemenu_tags static %}<!DOCTYPE html>
{% load i18n simplemenu_tags static %}
{% load resources_custom_tags %}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>QGIS {% block extratitle %}Plugins{% endblock %}</title>
Expand Down Expand Up @@ -157,11 +159,10 @@ <h5>Silver Sponsors</h5>
</div>

<p class="credit">{% trans "All content is licensed under" %} <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 licence (CC BY-SA)</a>.</p>
</div>
<div class="container">
{% block "credits" %}
<p class="credit">{% trans "Select graphics from " %}<a href="http://thenounproject.com" target="_blank">{% trans "The Noun Project collection" %}</a>.</p>
{% endblock %}
{% block "credits" %}
<p class="credit">{% trans "Select graphics from " %}<a href="http://thenounproject.com" target="_blank">{% trans "The Noun Project collection" %}</a>.</p>
<p class="credit">{% trans "This web application was developed by:" %}&nbsp;<a href="https://www.itopen.it">Alessandro Pasotti</a> and &nbsp;<a href="https://kartoza.com"><img src="{% static 'images/kartoza-logo-only.png' %}" alt="Kartoza icon" width="16" height="16">Kartoza</a>. <span>Version: {% version_tag %}</span>.</p>
{% endblock %}
</div>
</footer>
</div>
Expand Down
3 changes: 2 additions & 1 deletion qgis-app/templates/base/base.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends BASE_TEMPLATE %}{% load i18n static thumbnail %}
{% load resources_custom_tags %}
{% block extratitle %}{{ resource_name }}{% endblock %}
{% block app_title %}
<h2 xmlns="http://www.w3.org/1999/html">QGIS {{ resource_name }}</h2>
Expand Down Expand Up @@ -83,5 +84,5 @@ <h3>{% trans "Style Type" %}</h3>
{% endblock %}

{% block "credits" %}
{% trans "This web application was developed by:" %}&nbsp;<a href="https://www.itopen.it">Alessandro Pasotti</a> and &nbsp;<a href="https://kartoza.com"><img src="{% static 'images/kartoza-logo-only.png' %}" alt="Kartoza icon" width="16" height="16">Kartoza</a>.
{{ block.super }}
{% endblock %}

0 comments on commit 6398ab4

Please sign in to comment.