Skip to content

Commit

Permalink
[OS-636] Take the doctorate pre-admissions into account
Browse files Browse the repository at this point in the history
  • Loading branch information
jcougnaud committed Dec 2, 2024
1 parent b15c61e commit 6003166
Show file tree
Hide file tree
Showing 9 changed files with 189 additions and 57 deletions.
40 changes: 39 additions & 1 deletion contrib/forms/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,11 @@ class DoctorateAdmissionProjectForm(forms.Form):
class Media:
js = ('js/dependsOn.min.js',)

def __init__(self, hide_proximity_commission_fields=True, *args, **kwargs):
def __init__(self, admission_type, hide_proximity_commission_fields=True, *args, **kwargs):
self.person = getattr(self, 'person', kwargs.pop('person', None))
self.admission_type = admission_type
self.label_classes = self.get_field_label_classes()

super().__init__(*args, **kwargs)

# Set proximity commission fields value from API data
Expand Down Expand Up @@ -367,3 +370,38 @@ def get_selected_doctorate(self, sector, doctorat):
return next( # pragma: no branch
d for d in doctorats if doctorat == "{doctorat.sigle}-{doctorat.annee}".format(doctorat=d)
)

def get_field_label_classes(self):
"""Returns the classes that should be applied to the label of the form fields."""

possible_mandatory_fields = [
'justification',
'type_contrat_travail',
'eft',
'bourse_recherche',
'autre_bourse_recherche',
'raison_non_soutenue',
'titre_projet',
]

if self.admission_type == AdmissionType.ADMISSION.name:
possible_mandatory_fields += [
'type_financement',
'bourse_date_debut',
'bourse_date_fin',
'bourse_preuve',
'duree_prevue',
'temps_consacre',
'est_lie_fnrs_fria_fresh_csc',
'resume_projet',
'documents_projet',
'proposition_programme_doctoral',
'langue_redaction_these',
'projet_doctoral_deja_commence',
'projet_doctoral_institution',
'projet_doctoral_date_debut',
'institution',
'domaine_these',
]

return {field_name: 'required_text' for field_name in possible_mandatory_fields}
1 change: 1 addition & 0 deletions contrib/views/doctorate/form_tabs/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class DoctorateAdmissionProjectFormView(LoadDossierViewMixin, WebServiceFormMixi
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
kwargs['person'] = self.person
kwargs['admission_type'] = self.admission.type_admission
return kwargs

def get_initial(self):
Expand Down
4 changes: 4 additions & 0 deletions locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2462,6 +2462,10 @@ msgid ""
"<li>Without any filter nor any contour</li></ul>"
msgstr ""

msgid ""
"The promoters may be changed during the admissions process."
msgstr ""

msgid ""
"The secondary school diploma is the Certificat d'Enseignement Secondaire "
"Superieur (CESS, Certificate of Higher Secondary Education). It is commonly "
Expand Down
4 changes: 4 additions & 0 deletions locale/fr_BE/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2842,6 +2842,10 @@ msgstr ""
"et de face</strong></li> <li>Photo récente <strong>en couleur</strong></"
"li> <li>Aucun filtre appliqué ni trace de contour</li></ul>"

msgid ""
"The promoters may be changed during the admissions process."
msgstr "Le promoteur ou la promotrice pourront être modifiés au cours du processus d'admission."

msgid ""
"The secondary school diploma is the Certificat d'Enseignement Secondaire "
"Superieur (CESS, Certificate of Higher Secondary Education). It is commonly "
Expand Down
46 changes: 23 additions & 23 deletions templates/admission/doctorate/forms/project.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<br /> Please also consult the special provisions of the field for all pre-admission conditions.
{% endblocktrans %}
</p>
{% bootstrap_field form.justification form_group_class="form-group required_field" %}
{% bootstrap_field form.justification label_class=form.label_classes.justification %}
</div>
{% endif %}
</div>
Expand Down Expand Up @@ -91,50 +91,50 @@
{% panel _("Funding") %}
<div class="row">
<div class="col-md-4">
{% bootstrap_field_with_tooltip form.type_financement classes="form-group required_field" %}
{% bootstrap_field_with_tooltip form.type_financement label_class=form.label_classes.type_financement %}
</div>
</div>
<div class="row" id="work">
{% bootstrap_field form.type_contrat_travail show_help=False form_group_class="form-group col-md-4 required_field" %}
{% bootstrap_field form.type_contrat_travail show_help=False label_class=form.label_classes.type_contrat_travail form_group_class="form-group col-md-4" %}
<div class="col-md-4">
{% bootstrap_field form.eft form_group_class="form-group required_field" placeholder="" %}
{% bootstrap_field form.eft label_class=form.label_classes.eft placeholder="" %}
</div>
</div>
<div id="scholarship">
<div class="row">
{% bootstrap_field form.bourse_recherche form_group_class="form-group col-md-4 required_field" %}
{% bootstrap_field form.bourse_recherche label_class=form.label_classes.bourse_recherche form_group_class="form-group col-md-4" %}
<div id="other-scholarship-container" class="col-md-4 required_field">
{% bootstrap_field form.autre_bourse_recherche placeholder="" %}
</div>
</div>
<div class="row">
{% bootstrap_field form.bourse_date_debut form_group_class="form-group col-md-5 required_field" %}
{% bootstrap_field_with_tooltip form.bourse_date_fin classes="form-group col-md-4 required_field" %}
{% bootstrap_field form.bourse_date_debut label_class=form.label_classes.bourse_date_debut form_group_class="form-group col-md-5" %}
{% bootstrap_field_with_tooltip form.bourse_date_fin label_class=form.label_classes.bourse_date_fin classes="col-md-4" %}
</div>
{% bootstrap_field_with_tooltip form.bourse_preuve classes="form-group required_field" %}
{% bootstrap_field_with_tooltip form.bourse_preuve label_class=form.label_classes.bourse_preuve %}
</div>
<div id="financing-details" class="row">
<div class="col-md-6">
{% bootstrap_field form.duree_prevue placeholder="" form_group_class="form-group required_field" %}
{% bootstrap_field form.duree_prevue placeholder="" label_class=form.label_classes.duree_prevue %}
</div>
<div class="col-md-6">
{% bootstrap_field form.temps_consacre placeholder="" form_group_class="form-group required_field" %}
{% bootstrap_field form.temps_consacre placeholder="" label_class=form.label_classes.temps_consacre %}
</div>
<div class="col-md-6">
{% bootstrap_field_with_tooltip form.est_lie_fnrs_fria_fresh_csc classes="form-group required_field" %}
{% bootstrap_field_with_tooltip form.est_lie_fnrs_fria_fresh_csc label_class=form.label_classes.est_lie_fnrs_fria_fresh_csc %}
</div>
<div class="col-md-6">
{% bootstrap_field form.commentaire_financement form_group_class="form-group" %}
{% bootstrap_field form.commentaire_financement %}
</div>
</div>
{% endpanel %}

{% panel _("PhD research project") %}
{% bootstrap_field form.titre_projet form_group_class="form-group required_field" placeholder="" %}
{% bootstrap_field_with_tooltip form.resume_projet classes="form-group required_field" %}
{% bootstrap_field form.titre_projet label_class=form.label_classes.titre_projet placeholder="" %}
{% bootstrap_field_with_tooltip form.resume_projet label_class=form.label_classes.resume_projet %}
<div class="row">
<div class="col-md-4">
{% bootstrap_field form.langue_redaction_these form_group_class="form-group required_field" %}
{% bootstrap_field form.langue_redaction_these label_class=form.label_classes.langue_redaction_these %}
</div>
</div>
<div class="row">
Expand All @@ -148,35 +148,35 @@
website or from your doctoral manager.
{% endblocktrans %}
</p>
{% bootstrap_field form.documents_projet form_group_class="form-group required_field" %}
{% bootstrap_field form.documents_projet label_class=form.label_classes.documents_projet %}
{% if admission.type_admission == 'ADMISSION' %}
{% bootstrap_field form.proposition_programme_doctoral form_group_class="form-group required_field" %}
{% bootstrap_field form.proposition_programme_doctoral label_class=form.label_classes.proposition_programme_doctoral %}
{% endif %}
{% bootstrap_field_with_tooltip form.projet_formation_complementaire %}
{% bootstrap_field form.graphe_gantt %}
{% bootstrap_field form.lettres_recommandation %}
{% endpanel %}

{% panel _("PhD research experience") %}
{% bootstrap_field form.projet_doctoral_deja_commence form_group_class="form-group required_field" %}
{% bootstrap_field form.projet_doctoral_deja_commence label_class=form.label_classes.projet_doctoral_deja_commence %}
<div id="deja_commence">
<div class="row">
<div class="col-md-6">
{% bootstrap_field form.projet_doctoral_institution placeholder="" form_group_class="form-group required_field" %}
{% bootstrap_field form.projet_doctoral_institution placeholder="" label_class=form.label_classes.projet_doctoral_institution %}
</div>
<div class="col-md-6">
{% bootstrap_field form.projet_doctoral_date_debut form_group_class="form-group required_field" %}
{% bootstrap_field form.projet_doctoral_date_debut label_class=form.label_classes.projet_doctoral_date_debut %}
</div>
</div>
</div>
{% bootstrap_field_with_tooltip form.doctorat_deja_realise %}
<div id="previous_experience">
<div class="row">
<div class="col-md-6">
{% bootstrap_field form.institution placeholder="" form_group_class="form-group required_field" %}
{% bootstrap_field form.institution placeholder="" label_class=form.label_classes.institution %}
</div>
<div class="col-md-6">
{% bootstrap_field form.domaine_these placeholder="" form_group_class="form-group required_field" %}
{% bootstrap_field form.domaine_these placeholder="" label_class=form.label_classes.domaine_these %}
</div>
</div>
{% bootstrap_field form.non_soutenue %}
Expand All @@ -186,7 +186,7 @@
</div>
</div>
<div id="non-soutenue">
{% bootstrap_field form.raison_non_soutenue form_group_class="form-group required_field" placeholder="" %}
{% bootstrap_field form.raison_non_soutenue label_class=form.label_classes.raison_non_soutenue placeholder="" %}
</div>
</div>
{% endpanel %}
Expand Down
78 changes: 47 additions & 31 deletions templates/admission/doctorate/forms/supervision.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* The core business involves the administration of students, teachers,
* courses, programs and so on.
*
* Copyright (C) 2015-2023 Université catholique de Louvain (http://www.uclouvain.be)
* Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -88,40 +88,55 @@
<form class="osis-form" method="post" action="">
{% csrf_token %}
{% bootstrap_form_errors add_form %}
{% panel _("Add a promoter or a CA member") %}
<div class="row">
<div class="col-md-12">
{% bootstrap_field add_form.type %}
</div>
<div class="col-md-12">
{% bootstrap_field add_form.internal_external %}
</div>
<div id="tutor" class="col-md-6">
{% bootstrap_field add_form.tutor %}
</div>
<div id="person" class="col-md-6">
{% bootstrap_field add_form.person %}
</div>
<div class="col-md-6" id="external-person">
<div class="panel panel-default">
<div class="panel-body">
{% bootstrap_field add_form.prenom %}
{% bootstrap_field add_form.nom %}
{% bootstrap_field add_form.email %}
{% bootstrap_field add_form.est_docteur %}
{% bootstrap_field add_form.institution %}
{% bootstrap_field add_form.ville %}
{% bootstrap_field add_form.pays %}
{% bootstrap_field add_form.langue %}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
{% translate 'Add a promoter or a CA member' %}
{% if admission.type_admission == 'PRE_ADMISSION' %}
<a
tabindex="0"
class="fa fa-question-circle popover-buttons"
data-content="<p>{% translate 'The promoters may be changed during the admissions process.' %}</p>"
role="button"
></a>
{% endif %}
</h4>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-12">
{% bootstrap_field add_form.type %}
</div>
<div class="col-md-12">
{% bootstrap_field add_form.internal_external %}
</div>
<div id="tutor" class="col-md-6">
{% bootstrap_field add_form.tutor %}
</div>
<div id="person" class="col-md-6">
{% bootstrap_field add_form.person %}
</div>
<div class="col-md-6" id="external-person">
<div class="panel panel-default">
<div class="panel-body">
{% bootstrap_field add_form.prenom %}
{% bootstrap_field add_form.nom %}
{% bootstrap_field add_form.email %}
{% bootstrap_field add_form.est_docteur %}
{% bootstrap_field add_form.institution %}
{% bootstrap_field add_form.ville %}
{% bootstrap_field add_form.pays %}
{% bootstrap_field add_form.langue %}
</div>
</div>
</div>
</div>
<button
type="submit" class="btn btn-primary"
name="add_member_submit"
>{% trans "Add" %}</button>
</div>
<button
type="submit" class="btn btn-primary"
name="add_member_submit"
>{% trans "Add" %}</button>
{% endpanel %}
</div>
</form>
{% endif %}

Expand All @@ -142,6 +157,7 @@
{% endblock tab_content %}

{% block script %}
<script src="{% static 'admission/popover.js' %} "></script>
{{ add_form.media }}
{{ approval_form.media }}
{{ approve_by_pdf_form.media }}
Expand Down
2 changes: 1 addition & 1 deletion templates/admission/tags/bootstrap_field_with_tooltip.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{% bootstrap_field field %}
{% else %}
<div class="label-container">
<label class="control-label" for="{{ field.id_for_label }}">
<label class="control-label{% if label_class %} {{ label_class }}{% endif %}" for="{{ field.id_for_label }}">
{{ field.label }}
</label>
<a
Expand Down
3 changes: 2 additions & 1 deletion templatetags/admission.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,13 @@ def has_error_in_tab(context, admission, tab):


@register.inclusion_tag('admission/tags/bootstrap_field_with_tooltip.html')
def bootstrap_field_with_tooltip(field, classes='', show_help=False, html_tooltip=False):
def bootstrap_field_with_tooltip(field, classes='', show_help=False, html_tooltip=False, label_class=''):
return {
'field': field,
'classes': classes,
'show_help': show_help,
'html_tooltip': html_tooltip,
'label_class': label_class,
}


Expand Down
Loading

0 comments on commit 6003166

Please sign in to comment.