summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/models/__init__.py7
-rw-r--r--askbot/models/post.py3
-rw-r--r--askbot/templates/email/base_mail.html4
-rw-r--r--askbot/templates/email/instant_notification.html3
-rw-r--r--askbot/templates/email/macros.html18
-rw-r--r--askbot/templatetags/extra_filters_jinja.py10
-rw-r--r--askbot/tests/templatefilter_tests.py8
7 files changed, 31 insertions, 22 deletions
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py
index 2044dc16..833809d2 100644
--- a/askbot/models/__init__.py
+++ b/askbot/models/__init__.py
@@ -2941,7 +2941,8 @@ def format_instant_notification_email(
user_url = strip_path(site_url) + from_user.get_absolute_url()
user_action = user_action % {
'user': '<a href="%s">%s</a>' % (user_url, from_user.username),
- 'post_link': '<a href="%s">%s</a>' % (post_url, _(post.post_type))
+ 'post_link': '<a href="%s">%s<a>' % (post_url, _(post.post_type))
+ #'post_link': '%s <a href="%s">>>></a>' % (_(post.post_type), post_url)
}
can_reply = to_user.can_post_by_email()
@@ -2959,6 +2960,10 @@ def format_instant_notification_email(
reply_separator += '<p>' + \
const.REPLY_WITH_COMMENT_TEMPLATE % data
reply_separator += '</p>'
+ else:
+ reply_separator = '<p>%s</p>' % reply_separator
+
+ reply_separator += user_action
else:
reply_separator = user_action
diff --git a/askbot/models/post.py b/askbot/models/post.py
index 49220a63..e15516eb 100644
--- a/askbot/models/post.py
+++ b/askbot/models/post.py
@@ -840,15 +840,12 @@ class Post(models.Model):
if quote_level > 0, the post will be indented that number of times
todo: move to views?
"""
- from askbot.templatetags.extra_filters_jinja \
- import absolutize_urls_func
from askbot.skins.loaders import get_template
from django.template import Context
template = get_template('email/quoted_post.html')
data = {
'post': self,
'quote_level': quote_level,
- #'html': absolutize_urls_func(self.html),
'is_leaf_post': is_leaf_post,
'format': format
}
diff --git a/askbot/templates/email/base_mail.html b/askbot/templates/email/base_mail.html
index dfd252f2..eacbf87d 100644
--- a/askbot/templates/email/base_mail.html
+++ b/askbot/templates/email/base_mail.html
@@ -143,10 +143,10 @@
</tr>
<tr>
<td valign="top">
- <table border="0" align="center" cellspacing="0" cellpadding="0" style="background-color: #fff;" width=80%>
+ <table border="0" align="center" cellspacing="0" cellpadding="0" style="background-color: #fff;" width=90%>
<tr>
<td valign="top">
- <table border="0" align="center" cellspacing="0" cellpadding="0" width=80%>
+ <table border="0" align="center" cellspacing="0" cellpadding="0" width=95%>
<tr>
<td valign="top">
<h1>{%block headline%}{%endblock%}</h1>
diff --git a/askbot/templates/email/instant_notification.html b/askbot/templates/email/instant_notification.html
index 3e8533b6..d353450d 100644
--- a/askbot/templates/email/instant_notification.html
+++ b/askbot/templates/email/instant_notification.html
@@ -4,7 +4,8 @@
{{ reply_separator }}
<div>{{ content_preview }}</div>
{% trans %}
-<p>Please note - you can easily <a href="{{user_subscriptions_url}}">change</a>
+<p style="font-size:10px; font-style:italic;">
+Please note - you can easily <a href="{{user_subscriptions_url}}">change</a>
how often you receive these notifications or unsubscribe. Thank you for your interest in our forum!</p>
{% endtrans %}
{%endblock%}
diff --git a/askbot/templates/email/macros.html b/askbot/templates/email/macros.html
index d7817bf9..46aa1b90 100644
--- a/askbot/templates/email/macros.html
+++ b/askbot/templates/email/macros.html
@@ -1,3 +1,4 @@
+{% load extra_filters_jinja %}
{% macro quoted_post(
post = None,
quote_level = 0,
@@ -9,7 +10,7 @@
{{ start_quote(quote_level) }}
{% set author = post.author.username|escape %}
{% if post.post_type == 'question' %}
- <p>
+ <p style="font-size:10px; font-weight: bold;">
{% if format == 'parent_subthread' %}
{% if is_leaf_post %}
{% trans %}Question by {{ author }}:{% endtrans %}
@@ -22,21 +23,22 @@
{% trans %}Question :{% endtrans %}
{% endif %}
{{ post.thread.title }}
- </p>
- <p>
+ </p>
+ <p style="font-size:10px; font-weight: bold;">
{% if format != 'parent_subthread' %}
{% trans %}Asked by {{ author }}:{% endtrans %}
{% endif %}
- </p>
+ </p>
+ </p>
{% set tag_names = post.get_tag_names() %}
{% if tag_names %}
- <p>
+ <p style="font-size:10px; font-style:italic;">
{% trans %}Tags:{% endtrans %}
{{ tag_names|join(', ') }}.
</p>
{% endif %}
{% elif post.post_type == 'answer' %}
- <p>
+ <p style="font-size:10px; font-weight: bold;">
{% if format == 'parent_subthread' %}
{% if is_leaf_post %}
{% trans -%}
@@ -52,7 +54,7 @@
{% endif %}
</p>
{% else %}
- <p>
+ <p style="font-size:10px; font-weight: bold;">
{% if format == 'parent_subthread' %}
{% if is_leaf_post %}
{% trans -%}
@@ -70,7 +72,7 @@
{% endif %}
</p>
{% endif %}
- {{ post.html }}
+ {{ post.html | absolutize_urls}}
{{ end_quote(quote_level) }}
{% endspaceless %}
{% endmacro %}
diff --git a/askbot/templatetags/extra_filters_jinja.py b/askbot/templatetags/extra_filters_jinja.py
index 3643e3c9..62a41895 100644
--- a/askbot/templatetags/extra_filters_jinja.py
+++ b/askbot/templatetags/extra_filters_jinja.py
@@ -24,17 +24,19 @@ from django_countries import settings as countries_settings
register = coffin_template.Library()
-def absolutize_urls_func(text):
+@register.filter
+def absolutize_urls(text):
url_re1 = re.compile(r'(?P<prefix><img[^<]+src=)"(?P<url>/[^"]+)"', re.I)
url_re2 = re.compile(r"(?P<prefix><img[^<]+src=)'(?P<url>/[^']+)'", re.I)
url_re3 = re.compile(r'(?P<prefix><a[^<]+href=)"(?P<url>/[^"]+)"', re.I)
url_re4 = re.compile(r"(?P<prefix><a[^<]+href=)'(?P<url>/[^']+)'", re.I)
+ img_replacement = '\g<prefix>"%s\g<url>" style="max-width:500px;"' % askbot_settings.APP_URL
replacement = '\g<prefix>"%s\g<url>"' % askbot_settings.APP_URL
- text = url_re1.sub(replacement, text)
- text = url_re2.sub(replacement, text)
+ text = url_re1.sub(img_replacement, text)
+ text = url_re2.sub(img_replacement, text)
text = url_re3.sub(replacement, text)
return url_re4.sub(replacement, text)
-absolutize_urls = register.filter(absolutize_urls_func)
+
TIMEZONE_STR = pytz.timezone(
django_settings.TIME_ZONE
diff --git a/askbot/tests/templatefilter_tests.py b/askbot/tests/templatefilter_tests.py
index a82737a4..090be956 100644
--- a/askbot/tests/templatefilter_tests.py
+++ b/askbot/tests/templatefilter_tests.py
@@ -7,14 +7,16 @@ class AbsolutizeUrlsTests(TestCase):
askbot_settings.update('APP_URL', 'http://example.com')
def test_absolutize_image_urls(self):
text = """<img class="junk" src="/some.gif"> <IMG SRC='/some.png'>"""
- output = filters.absolutize_urls_func(text)
+ #jinja register.filter decorator works in a weird way
+ output = filters.absolutize_urls[0](text)
self.assertEqual(
output,
- '<img class="junk" src="http://example.com/some.gif"> <IMG SRC="http://example.com/some.png">'
+ '<img class="junk" src="http://example.com/some.gif" style="max-width:500px;"> <IMG SRC="http://example.com/some.png" style="max-width:500px;">'
)
def test_absolutize_anchor_urls(self):
text = """<a class="junk" href="/something">link</a> <A HREF='/something'>link</A>"""
- output = filters.absolutize_urls_func(text)
+ #jinja register.filter decorator works in a weird way
+ output = filters.absolutize_urls[0](text)
self.assertEqual(
output,
'<a class="junk" href="http://example.com/something">link</a> <A HREF="http://example.com/something">link</A>'