Skip to content

Commit

Permalink
apps/budgeting: display "map" as default back-link text, apps/proriza…
Browse files Browse the repository at this point in the history
…tions: display "back" as back-link text - fixes #4900
  • Loading branch information
fuzzylogic2000 committed Feb 6, 2023
1 parent 3686201 commit 2451072
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions meinberlin/apps/budgeting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,22 @@ def get_back(self):
are remembered when going back, we check if the referer is a
module or project detail view and add the appropriate back url.
"""
back_link = self.module.get_detail_url
back_string = _("map")
if "Referer" in self.request.headers:
referer = self.request.headers["Referer"]
parsed_url = urlparse(referer)
match = resolve(parsed_url.path)
if match.url_name == "project-detail" or match.url_name == "module-detail":
back_mode = None
back_string = _("map")
if "mode" in parse_qs(parsed_url.query):
back_mode = parse_qs(parsed_url.query)["mode"][0]
if back_mode == "list":
back_string = _("list")
back_link = referer + "#proposal_{}".format(self.object.id)
return back_link, back_string
return None, None
return None, None
return back_link, back_string
return back_link, back_string

def has_valid_token_in_session(self, request):
"""Return whether a valid token is stored in the session.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<li>
<a href="{{ module.get_detail_url }}">
<i class="fa fa-arrow-left" aria-hidden="true"></i>
{% translate 'list' %}
{% translate 'back' %}
</a>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<li>
<a href="{{ module.get_detail_url }}">
<i class="fa fa-arrow-left" aria-hidden="true"></i>
{% translate 'list' %}
{% translate 'back' %}
</a>
</li>
</ul>
Expand Down

0 comments on commit 2451072

Please sign in to comment.