Add the TODO_COMMENT_CLASSES setting

This commit is contained in:
Victor "multun" Collod 2019-02-12 17:08:20 +01:00
parent 84d7768854
commit 3cf694f985
3 changed files with 6 additions and 1 deletions

View file

@ -127,6 +127,9 @@ TODO_DEFAULT_LIST_SLUG = 'tickets'
# Defaults to "/" # Defaults to "/"
TODO_PUBLIC_SUBMIT_REDIRECT = 'dashboard' TODO_PUBLIC_SUBMIT_REDIRECT = 'dashboard'
# additionnal classes the comment body should hold
# adding "text-monospace" makes comment monospace
TODO_COMMENT_CLASSES = []
``` ```
The current django-todo version number is available from the [todo package](https://github.com/shacker/django-todo/blob/master/todo/__init__.py): The current django-todo version number is available from the [todo package](https://github.com/shacker/django-todo/blob/master/todo/__init__.py):

View file

@ -142,7 +142,7 @@
{{ comment.date|date:"F d Y P" }} {{ comment.date|date:"F d Y P" }}
</span> </span>
</div> </div>
<div class="text-monospace card-body"> <div class="{{ comment_classes | join:" " }} card-body">
{{ comment.body|safe|urlize|linebreaks }} {{ comment.body|safe|urlize|linebreaks }}
</div> </div>
</div> </div>

View file

@ -2,6 +2,7 @@ import bleach
import datetime import datetime
from django import forms from django import forms
from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.decorators import login_required, user_passes_test from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
@ -131,6 +132,7 @@ def task_detail(request, task_id: int) -> HttpResponse:
"form": form, "form": form,
"merge_form": merge_form, "merge_form": merge_form,
"thedate": thedate, "thedate": thedate,
"comment_classes": getattr(settings, 'TODO_COMMENT_CLASSES', []),
} }
return render(request, "todo/task_detail.html", context) return render(request, "todo/task_detail.html", context)