From c2d8fca40eeaae9eb12495b68ee8d858e3cb8042 Mon Sep 17 00:00:00 2001 From: Gregory Trullemans Date: Mon, 22 Apr 2024 10:36:30 +0200 Subject: [PATCH] Update mindstate form --- jarvis/core/templates/base.html | 2 - jarvis/core/templates/login.html | 7 -- jarvis/followup/forms.py | 35 ++++++---- .../followup/templates/wellbeing/create.html | 69 +++++++++++++------ static/css/jarvis.css | 38 +++++++++- 5 files changed, 105 insertions(+), 46 deletions(-) diff --git a/jarvis/core/templates/base.html b/jarvis/core/templates/base.html index 78d3a30..e4c828a 100644 --- a/jarvis/core/templates/base.html +++ b/jarvis/core/templates/base.html @@ -225,8 +225,6 @@ - - diff --git a/jarvis/core/templates/login.html b/jarvis/core/templates/login.html index 18289a9..1617ccc 100644 --- a/jarvis/core/templates/login.html +++ b/jarvis/core/templates/login.html @@ -111,13 +111,6 @@ - - - - - - - diff --git a/jarvis/followup/forms.py b/jarvis/followup/forms.py index 64aa8f4..ccb41d6 100644 --- a/jarvis/followup/forms.py +++ b/jarvis/followup/forms.py @@ -268,42 +268,47 @@ class WellBeingForm(forms.ModelForm): "event": forms.HiddenInput(), "mindstate": forms.NumberInput( attrs={ - "class": "form-control", - "placeholder": "x", - "min": "0", + "type": "range", + "min": "1", "max": "10", + "step": 1, + "class": "form-control", } ), "sleep": forms.NumberInput( attrs={ - "class": "form-control", - "placeholder": "x", - "min": "0", + "type": "range", + "min": "1", "max": "10", + "step": 1, + "class": "form-control", } ), "stress": forms.NumberInput( attrs={ - "class": "form-control", - "placeholder": "x", - "min": "0", + "type": "range", + "min": "1", "max": "10", + "step": 1, + "class": "form-control", } ), "fatigue": forms.NumberInput( attrs={ - "class": "form-control", - "placeholder": "x", - "min": "0", + "type": "range", + "min": "1", "max": "10", + "step": 1, + "class": "form-control", } ), "muscle_soreness": forms.NumberInput( attrs={ - "class": "form-control", - "placeholder": "x", - "min": "0", + "type": "range", + "min": "1", "max": "10", + "step": 1, + "class": "form-control", } ), "informations": forms.Textarea( diff --git a/jarvis/followup/templates/wellbeing/create.html b/jarvis/followup/templates/wellbeing/create.html index efca661..91ac966 100644 --- a/jarvis/followup/templates/wellbeing/create.html +++ b/jarvis/followup/templates/wellbeing/create.html @@ -49,8 +49,8 @@
- -
+ +
{{ form.mindstate }} {% if form.mindstate.errors %} @@ -60,13 +60,11 @@ {% endif %}
-
-

(1: Very Bad - 10: Very Good)

-
+
-
+
{{ form.sleep }} {% if form.sleep.errors %} @@ -76,13 +74,11 @@ {% endif %}
-
-

(1: Very Bad - 10: Very Good)

-
+
-
+
{{ form.stress }} {% if form.stress.errors %} @@ -92,13 +88,11 @@ {% endif %}
-
-

(1: Very Low - 10: Very High)

-
+
-
+
{{ form.fatigue }} {% if form.fatigue.errors %} @@ -108,13 +102,11 @@ {% endif %}
-
-

(1: Very Low - 10: Very High)

-
+
-
+
{{ form.muscle_soreness }} {% if form.muscle_soreness.errors %} @@ -124,9 +116,10 @@ {% endif %}
-
+
+
@@ -144,6 +137,7 @@
+
@@ -153,6 +147,40 @@ {% block footerscript %} {% endif %} - {% endblock %} \ No newline at end of file diff --git a/static/css/jarvis.css b/static/css/jarvis.css index 23a6714..1083ff9 100644 --- a/static/css/jarvis.css +++ b/static/css/jarvis.css @@ -149,4 +149,40 @@ textarea.form-control { .not-displayed-on-phone { display: none; } -} \ No newline at end of file +} + +/* INPUT RANGE */ +input[type="range"] { + -webkit-appearance: none; + appearance: none; + background: transparent; + padding: 0 !important; + border: 0 !important; + width: 25vw; +} + +/* range track */ +input[type="range"]::-webkit-slider-runnable-track { + background: #317BB5; + border-radius: 3px; + /* margin-bottom: .25rem; */ + height: 1rem; +} + +input[type="range"]::-moz-range-track { + background: #317BB5; + border-radius: 3px; + /* margin-bottom: .25rem; */ + /* height: .5rem; */ +} + +/* bullet */ +input[type="range"]::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + background-color: #BEBEBE; + width: 2rem; + height: 1.3rem; + border-radius: 3px; + margin-top: -2px; +}