diff --git a/helpdesk/forms.py b/helpdesk/forms.py index b9a00ee3..f1496ccb 100644 --- a/helpdesk/forms.py +++ b/helpdesk/forms.py @@ -606,6 +606,22 @@ class MultipleTicketSelectForm(forms.Form): return tickets +class ChecklistTemplateForm(forms.ModelForm): + name = forms.CharField( + widget=forms.TextInput(attrs={'class': 'form-control'}), + required=True, + ) + task_list = forms.JSONField(widget=forms.HiddenInput()) + + class Meta: + model = ChecklistTemplate + fields = ('name', 'task_list') + + def clean_task_list(self): + task_list = self.cleaned_data['task_list'] + return list(map(lambda task: task.strip(), task_list)) + + class ChecklistForm(forms.ModelForm): name = forms.CharField( widget=forms.TextInput(attrs={'class': 'form-control'}), diff --git a/helpdesk/models.py b/helpdesk/models.py index 7f9e2072..c2e90bb6 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -2010,7 +2010,7 @@ def is_a_list_without_empty_element(task_list): for task in task_list: if not isinstance(task, str): raise ValidationError(f'{task} is not a string') - if task == '': + if task.strip() == '': raise ValidationError('A task cannot be an empty string') diff --git a/helpdesk/static/helpdesk/helpdesk-extend.css b/helpdesk/static/helpdesk/helpdesk-extend.css index cdd6f2f0..f36f08d9 100644 --- a/helpdesk/static/helpdesk/helpdesk-extend.css +++ b/helpdesk/static/helpdesk/helpdesk-extend.css @@ -102,3 +102,7 @@ table .tickettitle { overflow: hidden; text-overflow: ellipsis; } + +.handle { + cursor: grab; +} diff --git a/helpdesk/templates/helpdesk/checklist_template_confirm_delete.html b/helpdesk/templates/helpdesk/checklist_template_confirm_delete.html new file mode 100644 index 00000000..d1da22bb --- /dev/null +++ b/helpdesk/templates/helpdesk/checklist_template_confirm_delete.html @@ -0,0 +1,47 @@ +{% extends "helpdesk/base.html" %} + +{% load i18n %} + +{% block helpdesk_title %}{% trans "Delete Checklist Template" %}{% endblock %} + +{% block helpdesk_breadcrumb %} +