Skip to content

Commit

Permalink
Add version number to template
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvarner committed Dec 8, 2021
1 parent ea8b3fc commit 9e2de37
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 41 deletions.
7 changes: 0 additions & 7 deletions apps/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
__version__ = "2.2.2"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num
for num in __version__.replace("-", ".", 1).split(".")
]
)
3 changes: 1 addition & 2 deletions apps/export/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
from django.core.serializers import serialize
from django.template.loader import get_template
from apps.users.models import User
from apps.readux import __version__
import digitaledition_jekylltheme
import config.settings.local as settings
from .github import GithubApi, GithubAccountNotFound


__version__ = "2.0.0"

LOGGER = logging.getLogger(__name__)

# zip file of base jekyll site with digital edition templates
Expand Down
4 changes: 4 additions & 0 deletions apps/readux/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import __version__

def current_version(request=None):
return {'APP_VERSION': __version__}
10 changes: 6 additions & 4 deletions apps/readux/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
from ..annotations import Annotations, AnnotationCrud
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.template import Context, Template
from django.core.serializers import serialize
from apps.iiif.annotations.models import Annotation
from apps.iiif.manifests.models import Manifest
from apps import readux
from ..models import UserAnnotation
from apps.readux.views import VolumesList, VolumeDetail, CollectionDetail, Collection, ExportOptions, AnnotationsCount
from ..context_processors import current_version
from apps.readux.views import VolumesList, CollectionDetail, ExportOptions, AnnotationsCount
from urllib.parse import urlencode
from cssutils import parseString
import warnings
import json
import re
import uuid
Expand Down Expand Up @@ -597,3 +596,6 @@ def test_user_annotation_count(self):
assert response.context_data['page'] == self.canvas
assert response.context_data['user_annotation_page_count'] == 3
assert response.context_data['user_annotation_count'] == 3

def test_current_version_context(self):
assert readux.__version__ == current_version()['APP_VERSION']
2 changes: 1 addition & 1 deletion apps/templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="uk-width-1-1">
<ul class="rx-footer uk-padding-remove">
<a href="http://digitalscholarship.emory.edu/projects/software/readux.html" target="_blank" alt="Readux by Emory Center for Digital Scholarship">
<li>Readux 2.0</li>
<li>Readux {{APP_VERSION}}</li>
</a>
</ul>
</div>
Expand Down
1 change: 1 addition & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
'apps.custom_styles.context_processors.add_custom_style',
'apps.templates.context_processors.has_ga_tracking_id',
'apps.templates.context_processors.ga_tracking_id',
'apps.readux.context_processors.current_version',
],
},
},
Expand Down
27 changes: 0 additions & 27 deletions readux/__init__.py

This file was deleted.

0 comments on commit 9e2de37

Please # to comment.