mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-06-22 08:38:21 +02:00
Enable registration form
This commit is contained in:
@ -86,6 +86,9 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if not user.is_authenticated %}
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="{% url "registration:signup" %}"><i class="fas fa-user-plus"></i> {% trans "Register" %}</a>
|
||||
</li>
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="{% url "login" %}"><i class="fas fa-sign-in-alt"></i> {% trans "Log in" %}</a>
|
||||
</li>
|
||||
|
@ -21,7 +21,7 @@
|
||||
</div>
|
||||
<div class="col-sm text-right">
|
||||
<div class="btn-group-vertical">
|
||||
<a class="btn btn-primary btn-lg" href="/inscription" role="button">Inscris-toi maintenant !</a>
|
||||
<a class="btn btn-primary btn-lg" href="{% url "registration:signup" %}" role="button">Inscris-toi maintenant !</a>
|
||||
<a class="btn btn-light btn-lg" href="{% url "login" %}" role="button">J'ai déjà un compte</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -10,8 +10,35 @@
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
<div id="student_registration_form">
|
||||
{{ student_registration_form|crispy }}
|
||||
</div>
|
||||
<div id="coach_registration_form" class="d-none">
|
||||
{{ coach_registration_form|crispy }}
|
||||
</div>
|
||||
<button class="btn btn-success" type="submit">
|
||||
{% trans "Sign up" %}
|
||||
</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block extrajavascript %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#id_role").change(function() {
|
||||
let selected_role = $("#id_role :selected");
|
||||
if (selected_role.val() === "participant") {
|
||||
$("#student_registration_form").removeClass("d-none");
|
||||
$("#coach_registration_form").addClass("d-none");
|
||||
}
|
||||
else {
|
||||
$("#student_registration_form").addClass("d-none");
|
||||
$("#coach_registration_form").removeClass("d-none");
|
||||
}
|
||||
});
|
||||
|
||||
$("#student_registration_form :input").removeAttr("required");
|
||||
$("#coach_registration_form :input").removeAttr("required");
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user