mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 18:44:23 +00:00
pedagogy: smart back button in uv_detail
This commit is contained in:
parent
a56a4e2cb8
commit
28748af5d3
@ -7,8 +7,16 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="pedagogy">
|
<div id="pedagogy">
|
||||||
<p><a href="{{ url('pedagogy:guide') }}">{% trans %}Back{% endtrans %}</a></p>
|
<p id="return_noscript"><a href="{{ url('pedagogy:guide') }}">{% trans %}Back{% endtrans %}</a></p>
|
||||||
{# <button onclick="window.history.back();">{% trans %}Back{% endtrans %}</button> #}
|
<button id="return_js" onclick='(function(){
|
||||||
|
// If comes from the guide page, go back with history
|
||||||
|
if (document.referrer.replace(/\?(.+)/gm,"").endsWith(`{{ url("pedagogy:guide") }}`)){
|
||||||
|
window.history.back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Simply goes to the guide page
|
||||||
|
window.location.href = `{{ url("pedagogy:guide") }}`;
|
||||||
|
})()' hidden>{% trans %}Back{% endtrans %}</button>
|
||||||
|
|
||||||
<h1>{{ object.code }} - {{ object.title }}</h1>
|
<h1>{{ object.code }} - {{ object.title }}</h1>
|
||||||
<p style = "word-spacing: 20px;">{{ object.department }} {{ object.credit_type }} {{ object.semester_translated }}</p>
|
<p style = "word-spacing: 20px;">{{ object.department }} {{ object.credit_type }} {{ object.semester_translated }}</p>
|
||||||
@ -79,4 +87,9 @@
|
|||||||
<p><input type="submit" value="{% trans %}Comment{% endtrans %}" /></p>
|
<p><input type="submit" value="{% trans %}Comment{% endtrans %}" /></p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#return_noscript").hide();
|
||||||
|
$("#return_js").show();
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user