diff --git a/settings/common.py b/settings/common.py index 93c349b9..34dc657d 100644 --- a/settings/common.py +++ b/settings/common.py @@ -184,6 +184,7 @@ INSTALLED_APPS = [ "taiga.projects.notifications", "taiga.projects.votes", "taiga.timeline", + "taiga.mdrender", "south", "reversion", diff --git a/taiga/mdrender/templatetags/__init__.py b/taiga/mdrender/templatetags/__init__.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/taiga/mdrender/templatetags/__init__.py @@ -0,0 +1 @@ + diff --git a/taiga/mdrender/templatetags/functions.py b/taiga/mdrender/templatetags/functions.py new file mode 100644 index 00000000..07110191 --- /dev/null +++ b/taiga/mdrender/templatetags/functions.py @@ -0,0 +1,26 @@ +# Copyright (C) 2014 Andrey Antukh +# Copyright (C) 2014 Jesús Espino +# Copyright (C) 2014 David Barragán +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from django_jinja import library +from jinja2 import Markup +from taiga.mdrender.service import render + +register = library.Library() + + +@register.global_function +def mdrender(project, text) -> str: + return Markup(render(project, text)) diff --git a/taiga/projects/history/templates/emails/includes/fields_diff-html.jinja b/taiga/projects/history/templates/emails/includes/fields_diff-html.jinja index 129c02af..8dad22b2 100644 --- a/taiga/projects/history/templates/emails/includes/fields_diff-html.jinja +++ b/taiga/projects/history/templates/emails/includes/fields_diff-html.jinja @@ -78,9 +78,21 @@ {% endif %} +{# DESCRIPTIONS #} + {% elif field_name in ["description"] %} + {% if values.1 != None or values.1 != "" %} +
+ to: {{ mdrender(object.project, values.1) }} +
+ {% endif %} + + {% if values.0 != None or values.0 != "" %} +
+ from: {{ mdrender(object.project, values.0) }} +
+ {% endif %} {# * #} {% else %} - {% if values.1 != None or values.1 != "" %}
to: {{ values.1|linebreaksbr }} diff --git a/taiga/projects/issues/templates/emails/update_issue_notification-body-html.jinja b/taiga/projects/issues/templates/emails/update_issue_notification-body-html.jinja index 96d47378..11ddedb5 100644 --- a/taiga/projects/issues/templates/emails/update_issue_notification-body-html.jinja +++ b/taiga/projects/issues/templates/emails/update_issue_notification-body-html.jinja @@ -11,7 +11,7 @@

Issue #{{ object.ref }}: {{ object.subject }}

Updated by {{ changer.get_full_name() }}.

{% if comment %} -

Comment {{ comment|linebreaksbr }}

+

Comment {{ mdrender(object.project, comment) }}

{% endif %} {% if changed_fields %}

Updated fields:

diff --git a/taiga/projects/tasks/templates/emails/update_task_notification-body-html.jinja b/taiga/projects/tasks/templates/emails/update_task_notification-body-html.jinja index c6e281a4..1a655513 100644 --- a/taiga/projects/tasks/templates/emails/update_task_notification-body-html.jinja +++ b/taiga/projects/tasks/templates/emails/update_task_notification-body-html.jinja @@ -11,7 +11,7 @@

Task #{{ object.ref }}: {{ object.subject }}

Updated by {{ changer.get_full_name() }}.

{% if comment %} -

Comment {{ comment|linebreaksbr }}

+

Comment {{ mdrender(object.project, comment) }}

{% endif %} {% if changed_fields %}

Updated fields:

diff --git a/taiga/projects/userstories/templates/emails/update_userstory_notification-body-html.jinja b/taiga/projects/userstories/templates/emails/update_userstory_notification-body-html.jinja index 913525ae..f73ad4e1 100644 --- a/taiga/projects/userstories/templates/emails/update_userstory_notification-body-html.jinja +++ b/taiga/projects/userstories/templates/emails/update_userstory_notification-body-html.jinja @@ -11,7 +11,7 @@

US #{{ object.ref }}: {{ object.subject }}

Updated by {{ changer.get_full_name() }}.

{% if comment %} -

Comment {{ comment|linebreaksbr }}

+

Comment {{ mdrender(object.project, comment)}}

{% endif %} {% if changed_fields %}

Updated fields:

diff --git a/taiga/projects/wiki/templates/emails/update_wiki_notification-body-html.jinja b/taiga/projects/wiki/templates/emails/update_wiki_notification-body-html.jinja index 89e3880d..3bde4285 100644 --- a/taiga/projects/wiki/templates/emails/update_wiki_notification-body-html.jinja +++ b/taiga/projects/wiki/templates/emails/update_wiki_notification-body-html.jinja @@ -11,7 +11,7 @@

Wiki Page: {{ object.slug }}

Updated by {{ changer.get_full_name() }}.

{% if comment %} -

Comment {{ comment|linebreaksbr }}

+

Comment {{ mdrender(object.project, comment) }}

{% endif %} {% if changed_fields %}

Updated fields: