Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Use a data attribute to store the current URL

Roland Geider85f0d35f0003
diff --git a/manager/static/js/workout-manager.js b/manager/static/js/workout-manager.js
index e8b2485a4..ffc0d813f 100644
--- a/manager/static/js/workout-manager.js
+++ b/manager/static/js/workout-manager.js
@@ -317,7 +317,7 @@ function modal_dialog_form_edit()
// a reload would not change the adress bar, but the content would.
// Since it is not possible to get this URL from the AJAX request, we read it out
// from a hidden HTML DIV in the document...
- current_url = $(data).find("#current-url").html();
+ current_url = $(data).find("#current-url").data('currentUrl');
if(document.URL.indexOf(current_url))
{
history.pushState({}, "", current_url);
diff --git a/manager/templates/base.html b/manager/templates/base.html
index 98f10bd51..ea170037f 100644
--- a/manager/templates/base.html
+++ b/manager/templates/base.html
@@ -118,7 +118,7 @@
<!--
This is needed as a clutch for us to handle redirects with AJAX
-->
- <div id="current-url" style="display:none;">{{request.get_full_path}}</div>
+ <div id="current-url" data-current-url="{{request.get_full_path}}"></div>
{% block content %}{% endblock %}
</div>
</article>