-
Notifications
You must be signed in to change notification settings - Fork 168
Replace bootstrap-datetimepicker #2608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
982e7e3
96ef45f
8eb3d24
6439923
79d0852
20219d4
1552cdc
979ae27
f40355d
1f4a889
ae3619a
73f0337
1c4eb9d
e49ebf5
b99dbc9
98ca7b0
b01f1e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,8 +14,12 @@ | |
| <title>{% block title %}EvaP{% endblock %}</title> | ||
|
|
||
| <link rel="stylesheet" href="{% static 'css/tom-select.bootstrap5.min.css' %}" /> | ||
| <link rel="stylesheet" href="{% static 'css/bootstrap-datetimepicker.min.css' %}" /> | ||
| <link rel="stylesheet" href="{% static 'css/evap.css' %}" /> | ||
| <link rel="stylesheet" href="{% static 'tempus-dominus/tempus-dominus.min.css' %}" /> | ||
| <script src="{%static 'js/popper.min.js' %}"></script> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should already be available via bootstrap, please check
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what do you mean exactly?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. btw it seems popper js script is needed, when i remove it, the datetimepicker breaks... |
||
| <script src="{% static 'tempus-dominus/tempus-dominus.min.js' %}"></script> | ||
| <script src="{% static 'tempus-dominus/tempus-dominus-date-init.js' %}"></script> | ||
| <script src="{% static 'tempus-dominus/tempus-dominus-datetime-init.js' %}"></script> | ||
| {% if debug %} | ||
| <link rel="icon" type="image/png" sizes="64x64" href="{% static 'images/favicon_gray.png' %}" /> | ||
| {% else %} | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <head> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need a head/body here? shouldn't all scripts and css be loaded by base.html? |
||
| {% load static %} | ||
| <link rel="stylesheet" href="{% static 'tempus-dominus/tempus-dominus.min.css' %}" /> | ||
| <!-- <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script> --> | ||
| <script src="{%static 'js/popper.min.js' %}"></script> | ||
| <script src="{% static 'tempus-dominus/tempus-dominus.min.js' %}"></script> | ||
| <!-- <script src="https://cdn.jsdelivr.net/npm/@eonasdan/tempus-dominus@6.9.4/dist/js/tempus-dominus.min.js" /> --> | ||
| <script src="{% static 'tempus-dominus/tempus-dominus-date-init.js' %}"></script> | ||
| </head> | ||
|
|
||
| <body> | ||
| <div class="input-group" id="datepicker1" data-td-target-input="nearest" data-td-target-toggle="nearest"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need the number in the id?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is included in the official documentation, but actually we don't need it, so i removed it. |
||
| <input id="datetimepicker1Input" | ||
| type="text" | ||
| class="form-control" | ||
| data-td-target="#datetimepicker1" | ||
| name="{{ widget.name }}" | ||
| {% if widget.value and widget.value != 'None' %} | ||
| value="{{ widget.value }}"{% endif %} | ||
| {% include 'django/forms/widgets/attrs.html' %} | ||
| /> | ||
| <span class="input-group-text" data-td-target="#datetimepicker1" data-td-toggle="datetimepicker"> | ||
| <i class="fas fa-calendar"></i> | ||
| </span> | ||
| </div> | ||
| </body> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <head> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here (head, ids) |
||
| {% load static %} | ||
| <link rel="stylesheet" href="{% static 'tempus-dominus/tempus-dominus.min.css' %}" /> | ||
| <!-- <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script> --> | ||
| <script src="{%static 'js/popper.min.js' %}"></script> | ||
| <script src="{% static 'tempus-dominus/tempus-dominus.min.js' %}"></script> | ||
| <!-- <script src="https://cdn.jsdelivr.net/npm/@eonasdan/tempus-dominus@6.9.4/dist/js/tempus-dominus.min.js" /> --> | ||
| <script src="{% static 'tempus-dominus/tempus-dominus-datetime-init.js' %}"></script> | ||
| </head> | ||
|
|
||
| <body> | ||
| <div class="input-group" id="datetimepicker1" data-td-target-input="nearest" data-td-target-toggle="nearest"> | ||
| <input id="datetimepicker1Input" | ||
| type="text" | ||
| class="form-control" | ||
| data-td-target="#datetimepicker1" | ||
| name="{{ widget.name }}" | ||
| {% if widget.value and widget.value != 'None' %} | ||
| value="{{ widget.value }}"{% endif %} | ||
| {% include 'django/forms/widgets/attrs.html' %} | ||
| /> | ||
| <span class="input-group-text" data-td-target="#datetimepicker1" data-td-toggle="datetimepicker"> | ||
| <i class="fas fa-calendar"></i> | ||
| </span> | ||
| </div> | ||
| </body> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,7 +72,3 @@ | |
| } | ||
| } | ||
| </script> | ||
|
|
||
| {% block additional_javascript %} | ||
| {% include 'bootstrap_datetimepicker.html' %} | ||
| {% endblock %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,8 +99,19 @@ def clean(self): | |
| class ImportForm(forms.Form): | ||
| use_required_attribute = False | ||
|
|
||
| vote_start_datetime = forms.DateTimeField(label=_("Start of evaluation"), localize=True, required=False) | ||
| vote_end_date = forms.DateField(label=_("End of evaluation"), localize=True, required=False) | ||
| vote_start_datetime = forms.DateTimeField( | ||
| label=_("Start of evaluation"), | ||
| widget=forms.DateTimeInput(), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this necessary? I would have expected tht |
||
| localize=True, | ||
| required=False, | ||
| ) | ||
|
|
||
| vote_end_date = forms.DateField( | ||
| label=_("End of evaluation"), | ||
| widget=forms.DateInput(attrs={"type": "date", "class": "form-control"}), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do we need |
||
| localize=True, | ||
| required=False, | ||
| ) | ||
|
|
||
| excel_file = forms.FileField( | ||
| label=_("Excel file"), | ||
|
|
@@ -283,8 +294,18 @@ def __init__(self, *args, **kwargs): | |
|
|
||
| class CourseCopyForm(CourseFormMixin, forms.ModelForm): # type: ignore[misc] | ||
| semester = forms.ModelChoiceField(Semester.objects.all()) | ||
| vote_start_datetime = forms.DateTimeField(label=_("Start of evaluations"), localize=True) | ||
| vote_end_date = forms.DateField(label=_("Last day of evaluations"), localize=True) | ||
|
|
||
| vote_start_datetime = forms.DateTimeField( | ||
| label=_("Start of evaluations"), | ||
| localize=True, | ||
| widget=forms.DateTimeInput(), | ||
| ) | ||
|
|
||
| vote_end_date = forms.DateField( | ||
| label=_("Last day of evaluations"), | ||
| localize=True, | ||
| widget=forms.DateInput(attrs={"type": "date", "class": "form-control"}), | ||
| ) | ||
|
|
||
| field_order = ["semester"] | ||
|
|
||
|
|
@@ -401,6 +422,10 @@ class Meta: | |
| field_classes = { | ||
| "participants": UserModelMultipleChoiceField, | ||
| } | ||
| widgets = { | ||
| "vote_start_datetime": forms.DateTimeInput(), | ||
| "vote_end_date": forms.DateInput(attrs={"type": "date", "class": "form-control"}), | ||
| } | ||
|
|
||
| def __init__(self, *args, requires_decided_main_language=False, **kwargs): | ||
| semester = kwargs.pop("semester", None) | ||
|
|
||
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // fix datetimepicker time selector width | ||
| .time-container-clock, | ||
| .time-container-hour, | ||
| .time-container-minute { | ||
| width: 100%; | ||
| } |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are the two tempus-dominus js files from us? then we should use typescript. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| document.addEventListener('DOMContentLoaded', function() { | ||
| const picker = new tempusDominus.TempusDominus(document.getElementById('datepicker1'), { | ||
| display: { | ||
| theme: 'light', | ||
| icons: { | ||
| time: 'fa fa-clock', | ||
| date: 'fa fa-calendar', | ||
| up: 'fa fa-arrow-up', | ||
| down: 'fa fa-arrow-down', | ||
| previous: 'fa fa-chevron-left', | ||
| next: 'fa fa-chevron-right', | ||
| today: 'fa fa-calendar-check', | ||
| clear: 'fa fa-trash', | ||
| close: 'fa fa-times' | ||
| }, | ||
| components: { | ||
| clock: false, // Hides the clock toggle button | ||
| hours: false, // Hides the hour picker | ||
| minutes: false, // Hides the minute picker | ||
| seconds: false // (Already false by default, but good to ensure) | ||
| }, | ||
| }, | ||
| localization: { | ||
| format: 'yyyy-MM-dd', | ||
| startOfTheWeek: 1, | ||
| hourCycle: 'h23' | ||
| } | ||
| }); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.