Now emails are sended with wiki rendering information

remotes/origin/enhancement/email-actions
Jesús Espino 2014-06-05 12:32:52 +02:00
parent 236d037770
commit 813239c601
8 changed files with 45 additions and 5 deletions

View File

@ -184,6 +184,7 @@ INSTALLED_APPS = [
"taiga.projects.notifications", "taiga.projects.notifications",
"taiga.projects.votes", "taiga.projects.votes",
"taiga.timeline", "taiga.timeline",
"taiga.mdrender",
"south", "south",
"reversion", "reversion",

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,26 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# 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 <http://www.gnu.org/licenses/>.
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))

View File

@ -78,9 +78,21 @@
</dd> </dd>
{% endif %} {% endif %}
{# DESCRIPTIONS #}
{% elif field_name in ["description"] %}
{% if values.1 != None or values.1 != "" %}
<dd style="background: #eee; padding: 5px 15px; color: #444">
<b>to:</b> <i>{{ mdrender(object.project, values.1) }}</i>
</dd>
{% endif %}
{% if values.0 != None or values.0 != "" %}
<dd style="padding: 5px 15px; color: #bbb">
<b>from:</b> <i>{{ mdrender(object.project, values.0) }}</i>
</dd>
{% endif %}
{# * #} {# * #}
{% else %} {% else %}
{% if values.1 != None or values.1 != "" %} {% if values.1 != None or values.1 != "" %}
<dd style="background: #eee; padding: 5px 15px; color: #444"> <dd style="background: #eee; padding: 5px 15px; color: #444">
<b>to:</b> <i>{{ values.1|linebreaksbr }}</i> <b>to:</b> <i>{{ values.1|linebreaksbr }}</i>

View File

@ -11,7 +11,7 @@
<h2>Issue #{{ object.ref }}: {{ object.subject }}</h2> <h2>Issue #{{ object.ref }}: {{ object.subject }}</h2>
<p>Updated by <b>{{ changer.get_full_name() }}</b>.</p> <p>Updated by <b>{{ changer.get_full_name() }}</b>.</p>
{% if comment %} {% if comment %}
<p>Comment <b>{{ comment|linebreaksbr }}</b></p> <p>Comment <b>{{ mdrender(object.project, comment) }}</b></p>
{% endif %} {% endif %}
{% if changed_fields %} {% if changed_fields %}
<p>Updated fields:</p> <p>Updated fields:</p>

View File

@ -11,7 +11,7 @@
<h2>Task #{{ object.ref }}: {{ object.subject }}</h2> <h2>Task #{{ object.ref }}: {{ object.subject }}</h2>
<p>Updated by <b>{{ changer.get_full_name() }}</b>.</p> <p>Updated by <b>{{ changer.get_full_name() }}</b>.</p>
{% if comment %} {% if comment %}
<p>Comment <b>{{ comment|linebreaksbr }}</b></p> <p>Comment <b>{{ mdrender(object.project, comment) }}</b></p>
{% endif %} {% endif %}
{% if changed_fields %} {% if changed_fields %}
<p>Updated fields:</p> <p>Updated fields:</p>

View File

@ -11,7 +11,7 @@
<h2>US #{{ object.ref }}: {{ object.subject }}</h2> <h2>US #{{ object.ref }}: {{ object.subject }}</h2>
<p>Updated by <b>{{ changer.get_full_name() }}</b>.</p> <p>Updated by <b>{{ changer.get_full_name() }}</b>.</p>
{% if comment %} {% if comment %}
<p>Comment <b>{{ comment|linebreaksbr }}</b></p> <p>Comment <b>{{ mdrender(object.project, comment)}}</b></p>
{% endif %} {% endif %}
{% if changed_fields %} {% if changed_fields %}
<p>Updated fields:</p> <p>Updated fields:</p>

View File

@ -11,7 +11,7 @@
<h2>Wiki Page: {{ object.slug }}</h2> <h2>Wiki Page: {{ object.slug }}</h2>
<p>Updated by <b>{{ changer.get_full_name() }}</b>.</p> <p>Updated by <b>{{ changer.get_full_name() }}</b>.</p>
{% if comment %} {% if comment %}
<p>Comment <b>{{ comment|linebreaksbr }}</b></p> <p>Comment <b>{{ mdrender(object.project, comment) }}</b></p>
{% endif %} {% endif %}
{% if changed_fields %} {% if changed_fields %}
<p>Updated fields:</p> <p>Updated fields:</p>