Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions evap/contributor/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class Meta:
"participants": UserModelMultipleChoiceField,
}

widgets = {
"vote_start_datetime": forms.DateTimeInput(attrs={"type": "date", "class": "form-control"}),
Comment thread
HannesClausnitzer marked this conversation as resolved.
Outdated
"vote_end_date": forms.DateInput(attrs={"type": "date", "class": "form-control"}),
}

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

Expand Down
1 change: 0 additions & 1 deletion evap/evaluation/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<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' %}" />
{% if debug %}
<link rel="icon" type="image/png" sizes="64x64" href="{% static 'images/favicon_gray.png' %}" />
Expand Down
4 changes: 0 additions & 4 deletions evap/evaluation/templates/evap_evaluation_edit_js.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,3 @@
}
}
</script>

{% block additional_javascript %}
{% include 'bootstrap_datetimepicker.html' %}
{% endblock %}
4 changes: 4 additions & 0 deletions evap/rewards/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class RewardPointRedemptionEventForm(forms.ModelForm):
class Meta:
model = RewardPointRedemptionEvent
fields = ("name_en", "name_de", "date", "redeem_end_date", "step")
widgets = {
"date": forms.DateInput(attrs={"type": "date", "class": "form-control"}),
"redeem_end_date": forms.DateInput(attrs={"type": "date", "class": "form-control"}),
}

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,3 @@
</div>
</form>
{% endblock %}

{% block additional_javascript %}
{% include 'bootstrap_datetimepicker.html' %}
{% endblock %}
33 changes: 29 additions & 4 deletions evap/staff/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(attrs={"type": "datetime-local", "class": "form-control"}),
localize=True,
required=False,
)

vote_end_date = forms.DateField(
label=_("End of evaluation"),
widget=forms.DateInput(attrs={"type": "date", "class": "form-control"}),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we need "type": "date" for here? Should it just be part of the default for the widget? (And I guess the same for "class": "form-control")

localize=True,
required=False,
)

excel_file = forms.FileField(
label=_("Excel file"),
Expand Down Expand Up @@ -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(attrs={"type": "datetime-local", "class": "form-control"}),
)

vote_end_date = forms.DateField(
label=_("Last day of evaluations"),
localize=True,
widget=forms.DateInput(attrs={"type": "date", "class": "form-control"}),
)

field_order = ["semester"]

Expand Down Expand Up @@ -401,6 +422,10 @@ class Meta:
field_classes = {
"participants": UserModelMultipleChoiceField,
}
widgets = {
"vote_start_datetime": forms.DateTimeInput(attrs={"type": "datetime-local", "class": "form-control"}),
"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)
Expand Down
4 changes: 0 additions & 4 deletions evap/staff/templates/staff_course_copyform.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@ <h5 class="card-title">{% translate 'Evaluations that will be copied' %}</h5>
</div>
</form>
{% endblock %}

{% block additional_javascript %}
{% include 'bootstrap_datetimepicker.html' %}
{% endblock %}
13 changes: 0 additions & 13 deletions evap/staff/templates/staff_semester_import.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,3 @@ <h3>{% translate 'Import semester data' %}</h3>
</div>
</form>
{% endblock %}
Comment thread
HannesClausnitzer marked this conversation as resolved.

{% block additional_javascript %}
{% include 'bootstrap_datetimepicker.html' %}
<script type="module">
import { copyHeaders } from "{% static 'js/copy-to-clipboard.js' %}";

document.getElementById("copy-headers-button").addEventListener("click", async () => await copyHeaders([
'Program', 'Participant last name', 'Participant first name', 'Participant email address', 'Course kind',
'Course is graded', 'Course name (de)', 'Course name (en)', 'Responsible title', 'Responsible last name',
'Responsible first name', 'Responsible email address'])
);
Comment thread
HannesClausnitzer marked this conversation as resolved.
</script>
{% endblock %}