summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-05-31 03:31:48 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-05-31 03:31:48 -0400
commit88be32db4e28a546a474523d835d209cb7ec9f13 (patch)
tree899cd3430edd0169b1a047b999927fb44e548fd6
parentb5e757b4deaa61f78f9fa3fd9b568ec6f8675e73 (diff)
downloadaskbot-88be32db4e28a546a474523d835d209cb7ec9f13.tar.gz
askbot-88be32db4e28a546a474523d835d209cb7ec9f13.tar.bz2
askbot-88be32db4e28a546a474523d835d209cb7ec9f13.zip
changed some phrasing in the email notification
-rw-r--r--askbot/models/__init__.py2
-rw-r--r--askbot/models/post.py15
-rw-r--r--askbot/skins/default/templates/email/macros.html38
-rw-r--r--askbot/skins/default/templates/email/quoted_post.html5
4 files changed, 52 insertions, 8 deletions
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py
index cc1209d2..24d4a3fc 100644
--- a/askbot/models/__init__.py
+++ b/askbot/models/__init__.py
@@ -2653,7 +2653,7 @@ def format_instant_notification_email(
)
#todo: remove hardcoded style
else:
- content_preview = post.format_for_email()
+ content_preview = post.format_for_email(is_leaf_post = True)
#add indented summaries for the parent posts
content_preview += post.format_for_email_as_parent_thread_summary()
diff --git a/askbot/models/post.py b/askbot/models/post.py
index 81edcc6d..673b4c6f 100644
--- a/askbot/models/post.py
+++ b/askbot/models/post.py
@@ -604,7 +604,9 @@ class Post(models.Model):
"""
return html_utils.strip_tags(self.html)[:max_length] + ' ...'
- def format_for_email(self, quote_level = 0):
+ def format_for_email(
+ self, quote_level = 0, is_leaf_post = False, format = None
+ ):
"""format post for the output in email,
if quote_level > 0, the post will be indented that number of times
todo: move to views?
@@ -617,7 +619,9 @@ class Post(models.Model):
data = {
'post': self,
'quote_level': quote_level,
- 'html': absolutize_urls_func(self.html)
+ #'html': absolutize_urls_func(self.html),
+ 'is_leaf_post': is_leaf_post,
+ 'format': format
}
return template.render(Context(data))
@@ -632,6 +636,7 @@ class Post(models.Model):
if parent_post is None:
break
quote_level += 1
+ """
output += '<p>'
output += _(
'In reply to %(user)s %(post)s of %(date)s'
@@ -641,7 +646,11 @@ class Post(models.Model):
'date': parent_post.added_at.strftime(const.DATETIME_FORMAT)
}
output += '</p>'
- output += parent_post.format_for_email(quote_level = quote_level)
+ """
+ output += parent_post.format_for_email(
+ quote_level = quote_level,
+ format = 'parent_subthread'
+ )
current_post = parent_post
return output
diff --git a/askbot/skins/default/templates/email/macros.html b/askbot/skins/default/templates/email/macros.html
index f69dc541..078c5c16 100644
--- a/askbot/skins/default/templates/email/macros.html
+++ b/askbot/skins/default/templates/email/macros.html
@@ -1,4 +1,10 @@
-{% macro quoted_post(post = None, quote_level = 0) %}
+{% macro quoted_post(
+ post = None,
+ quote_level = 0,
+ format = None,
+ is_leaf_post = False
+ )
+%}
{% spaceless %}
{{ start_quote(quote_level) }}
{% set author = post.author.username %}
@@ -21,11 +27,37 @@
{% endif %}
{% elif post.post_type == 'answer' %}
<p>
- {% trans %}Answered by {{ author }}:{% endtrans %}
+ {% if format == 'parent_subthread' %}
+ {% if is_leaf_post %}
+ {% trans -%}
+ {{ author }}'s answer:
+ {%- endtrans %}
+ {% else %}
+ {% trans -%}
+ In reply to {{ author }}'s answer:
+ {%- endtrans %}
+ {% endif %}
+ {% else %}
+ {% trans %}Answered by {{ author }}:{% endtrans %}
+ {% endif %}
</p>
{% else %}
<p>
- {% trans author %}Commented by {{ author }}:{% endtrans %}
+ {% if format == 'parent_subthread' %}
+ {% if is_leaf_post %}
+ {% trans -%}
+ {{ author }}'s comment:
+ {%- endtrans %}
+ {% else %}
+ {% trans -%}
+ In reply to {{ author }}'s comment:
+ {%- endtrans %}
+ {% endif %}
+ {% else %}
+ {% trans author -%}
+ Commented by {{ author }}:
+ {%- endtrans %}
+ {% endif %}
</p>
{% endif %}
{{ post.html }}
diff --git a/askbot/skins/default/templates/email/quoted_post.html b/askbot/skins/default/templates/email/quoted_post.html
index d93661a1..ecc20ad9 100644
--- a/askbot/skins/default/templates/email/quoted_post.html
+++ b/askbot/skins/default/templates/email/quoted_post.html
@@ -1,2 +1,5 @@
{% from "email/macros.html" import quoted_post %}
-{{ quoted_post(post, quote_level) }}
+{{ quoted_post(
+ post, quote_level, is_leaf_post = is_leaf_post, format = format
+ )
+}}