Skip to content

Commit

Permalink
Merge pull request #531 from rl-institut/release/v1.2.0
Browse files Browse the repository at this point in the history
Release/v1.2.0
  • Loading branch information
henhuy authored Oct 5, 2020
2 parents d736916 + d37e7d1 commit 0cf02fa
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project tries to adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.0] - 2020-10-05
### Added
- posthog event to distinguish between mobile/desktop device

## [1.1.0] - 2020-09-02
### Changed
- legal and dgstvo links are not shown on summary page

### Fixed
- On some devices desktop parts were hidden

Expand Down
2 changes: 1 addition & 1 deletion e_metrobus/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.1.0"
__version__ = "1.2.0"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num
Expand Down
1 change: 1 addition & 0 deletions e_metrobus/navigation/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
path("get_desktop_page/", view=views.DesktopPage.as_view(), name="get_desktop_page"),
path("accept_privacy_policy/", views.accept_privacy_policy),
path("send_posthog_event/", views.send_posthog_event),
path("check_mobile/", views.check_mobile),
path(
"get_comparison_chart/", views.get_comparison_chart, name="get_comparison_chart"
),
Expand Down
8 changes: 8 additions & 0 deletions e_metrobus/navigation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,8 @@ def get_context_data(self, **kwargs):
context["visited"] = True
if "privacy" in self.request.session:
context["privacy_accepted"] = True
if "mobile" not in self.request.session:
context["initial_mobile_check"] = True
return context


Expand All @@ -465,6 +467,12 @@ def send_posthog_event(request):
return HttpResponse()


def check_mobile(request):
request.session["mobile"] = request.GET["is_mobile"]
utils.posthog_event(request)
return HttpResponse()


def get_comparison_chart(request):
chart_order = ("pedestrian", "e-bus", "e-pkw", "bus", "car")
route = request.GET["route"]
Expand Down
8 changes: 8 additions & 0 deletions e_metrobus/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@
$("#desktop").show();
$("#portrait").remove();
}

{% if initial_mobile_check %}
$.ajax({
url: "/check_mobile/",
dataType: "html",
data: {"is_mobile": check_mobile()}
});
{% endif %}
</script>
{% endblock javascript %}
</body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "e_metrobus",
"version": "1.1.0",
"version": "1.2.0",
"dependencies": {},
"devDependencies": {
"autoprefixer": "^9.4.7",
Expand Down

0 comments on commit 0cf02fa

Please sign in to comment.