Auto-reload with turbolinks
This commit is contained in:
parent
abee482257
commit
204623c960
|
@ -12,6 +12,8 @@ class Ticket(models.Model):
|
||||||
|
|
||||||
note = models.CharField(
|
note = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
verbose_name=_("note")
|
verbose_name=_("note")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,3 +5,10 @@ from django.views.generic import TemplateView
|
||||||
|
|
||||||
class TombolaView(TemplateView):
|
class TombolaView(TemplateView):
|
||||||
template_name = "tombola.html"
|
template_name = "tombola.html"
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data()
|
||||||
|
|
||||||
|
context['title'] = "Tombola Saper[list]popette"
|
||||||
|
|
||||||
|
return context
|
||||||
|
|
|
@ -90,7 +90,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
<form action="{% url 'set_language' %}" method="post"
|
<form action="{% url 'set_language' %}" method="post"
|
||||||
class="form-inline">
|
class="form-inline">
|
||||||
<span class="text-muted mr-1">
|
<span class="text-muted mr-1">
|
||||||
NoteKfet2020 —
|
Tombola Saper[list]popette —
|
||||||
<a href="mailto:tresorie.bde@lists.crans.org"
|
<a href="mailto:tresorie.bde@lists.crans.org"
|
||||||
class="text-muted">Nous contacter</a> —
|
class="text-muted">Nous contacter</a> —
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -2,10 +2,34 @@
|
||||||
|
|
||||||
{% load i18n static %}
|
{% load i18n static %}
|
||||||
|
|
||||||
{# Remove page title #}
|
{% block extracss %}
|
||||||
{% block contenttitle %}{% endblock %}
|
<meta name="turbolinks-cache-control" content="no-preview">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block extrajavascript %}
|
||||||
|
<script>
|
||||||
|
var reloadWithTurbolinks = (function () {
|
||||||
|
var scrollPosition
|
||||||
|
|
||||||
|
function reload () {
|
||||||
|
scrollPosition = [window.scrollX, window.scrollY]
|
||||||
|
Turbolinks.visit(window.location.toString(), { action: 'replace' })
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('turbolinks:load', function () {
|
||||||
|
if (scrollPosition) {
|
||||||
|
window.scrollTo.apply(window, scrollPosition)
|
||||||
|
scrollPosition = null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return reload
|
||||||
|
})()
|
||||||
|
|
||||||
|
setTimeout(function(){ reloadWithTurbolinks(); }, 2000);
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue