Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Site Interludes
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediatek
Site Interludes
Commits
68b63294
Commit
68b63294
authored
3 years ago
by
Dorian Lesbre
Browse files
Options
Downloads
Patches
Plain Diff
Removed inscription details unused when distant
parent
8d95d4df
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
home/templates/admin.html
+2
-2
2 additions, 2 deletions
home/templates/admin.html
home/templates/inscription/form-distanciel.html
+102
-0
102 additions, 0 deletions
home/templates/inscription/form-distanciel.html
home/views.py
+1
-1
1 addition, 1 deletion
home/views.py
with
105 additions
and
3 deletions
home/templates/admin.html
+
2
−
2
View file @
68b63294
...
...
@@ -67,7 +67,7 @@
<div
class=
"nb_small"
>
{{ metrics.sleeps }}
</div>
</div>
</div>
<!--
<div class="flex wrap lines">
<div class="stat">
<div class="qty">Repas</div>
...
...
@@ -98,7 +98,7 @@
<div class="nb_small">{{ metrics.meal6 }}</div>
</div>
</div>
-->
<div
class=
"flex wrap lines"
>
<div
class=
"stat"
>
<div
class=
"qty"
>
Activités
</div>
...
...
This diff is collapsed.
Click to expand it.
home/templates/inscription/form-distanciel.html
0 → 100644
+
102
−
0
View file @
68b63294
{% extends "base.html" %}
{% load static %}
{% block nav_inscription %}current{% endblock %}
{% block "content" %}
<h2>
Inscriptions
</h2>
<form
id=
"main_form"
method=
"post"
action=
"{% url 'inscription' %}"
>
{% csrf_token %}
Cette année, l'événement étant en distanciel, il est gratuit.
<p>
{{ form.school.label_tag }} {{ form.school }}
</p>
<h3>
Choix d'activités
</h3>
<p>
Saissisez les activités auquelles vous voulez vous inscrire, par ordre de préférence.
Vous trouverez une description des activités sur
<a
href=
"{% url 'activites' %}"
>
cette page
</a>
.
</p>
<p>
Vous pouvez revenir modifier votre choix jusqu'à la fermeture des
inscriptions{% if settings.inscriptions_end %} (le {{ settings.inscriptions_end|date:"l d F Y à H:i" }}){% endif %}.
</p>
<p>
Si vous vous inscrivez à une activité qui nécessite préparation, nous communiquerons
votre email aux orgas pour qu'iels puissent vous contacter.
</p>
{% if formset.non_form_errors %}
{{ formset.non_form_errors }}
{% endif %}
{{ formset.management_data }}
{{ formset.management_form }}
{% for form in formset %}
<div
class=
"activity-form flex"
>
{{ form.as_p }}
<button
class=
"button delete-activity"
style=
"align-self: center; flex-grow: 0;"
>
Supprimer
</button>
</div>
{% endfor %}
<button
class=
"button"
id=
"add-activity"
>
Ajouter une activité
</button>
<div
class=
"flex"
>
<input
type=
"submit"
value=
"Valider"
>
<a
class=
"button"
href=
"{% url 'accounts:profile' %}"
>
Annuler
</a>
</div>
</form>
<script>
const
button_add_activity
=
document
.
querySelector
(
"
#add-activity
"
);
const
button_submit_form
=
document
.
querySelector
(
'
[type="submit"]
'
);
const
activity_form
=
document
.
getElementsByClassName
(
"
activity-form
"
);
const
main_form
=
document
.
querySelector
(
"
#main_form
"
);
const
total_forms
=
document
.
querySelector
(
"
#id_form-TOTAL_FORMS
"
);
const
form_regex
=
/form-
(\d
*
)
-/g
;
var
form_count
=
activity_form
.
length
-
1
;
function
add_new_form
(
event
)
{
// adds a new activity form when clicking on the + button
event
.
preventDefault
();
// clone the first form and replaces it's id
const
new_form
=
activity_form
[
0
].
cloneNode
(
true
);
form_count
++
;
new_form
.
innerHTML
=
new_form
.
innerHTML
.
replace
(
form_regex
,
`form-
${
form_count
}
-`
);
// add it and increment form total
main_form
.
insertBefore
(
new_form
,
button_add_activity
);
new_form
.
querySelector
(
"
select
"
).
value
=
""
;
total_forms
.
setAttribute
(
"
value
"
,
`
${
form_count
+
1
}
`
);
}
button_add_activity
.
addEventListener
(
"
click
"
,
add_new_form
);
function
delete_form
(
event
)
{
if
(
!
event
.
target
.
classList
.
contains
(
"
delete-activity
"
))
return
;
event
.
preventDefault
();
if
(
form_count
==
0
)
{
// don't delete the first element
activity_form
[
0
].
querySelector
(
"
select
"
).
value
=
""
;
return
;
}
event
.
target
.
parentElement
.
remove
();
form_count
--
;
total_forms
.
setAttribute
(
"
value
"
,
`
${
form_count
+
1
}
`
);
// update form numbers
let
count
=
0
;
for
(
const
form
of
activity_form
)
{
// the replace changes the field value
// so we save and restore it
const
select
=
form
.
querySelector
(
"
select
"
);
const
value
=
select
.
value
;
form
.
innerHTML
=
form
.
innerHTML
.
replace
(
form_regex
,
`form-
${
count
++
}
-`
);
form
.
querySelector
(
"
select
"
).
value
=
value
;
}
}
main_form
.
addEventListener
(
"
click
"
,
delete_form
);
</script>
{% endblock %}
This diff is collapsed.
Click to expand it.
home/views.py
+
1
−
1
View file @
68b63294
...
...
@@ -75,7 +75,7 @@ class RegisterSignIn(TemplateView):
class
RegisterUpdateView
(
LoginRequiredMixin
,
TemplateView
):
"""
Vue pour s
'
inscrire et modifier son inscription
"""
template_name
=
"
inscription/form.html
"
template_name
=
"
inscription/form
-distanciel
.html
"
form_class
=
InscriptionForm
formset_class
=
formset_factory
(
form
=
ActivityForm
,
extra
=
3
,
formset
=
BaseActivityFormSet
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment