From 5b4841cf29eb62cbdc1cf86f07aac0a228420bb4 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Tue, 9 Aug 2011 10:36:48 -0400 Subject: fixing diff problem, fixing spacing, style details --- askbot/models/answer.py | 2 +- askbot/models/base.py | 10 +++++----- askbot/models/question.py | 22 +++++++++++++++------- askbot/skins/default/media/style/style.css | 13 +++++++++++++ .../default/templates/user_profile/user_inbox.html | 8 +++++--- 5 files changed, 39 insertions(+), 16 deletions(-) diff --git a/askbot/models/answer.py b/askbot/models/answer.py index b07f8d25..6a2cceee 100644 --- a/askbot/models/answer.py +++ b/askbot/models/answer.py @@ -310,7 +310,7 @@ class AnswerRevision(ContentRevision): def get_question_title(self): return self.answer.question.title - def as_html(self): + def as_html(self, **kwargs): markdowner = markup.get_parser() return sanitize_html(markdowner.convert(self.text)) diff --git a/askbot/models/base.py b/askbot/models/base.py index 3af19318..53d5918b 100644 --- a/askbot/models/base.py +++ b/askbot/models/base.py @@ -8,7 +8,7 @@ from django.contrib.contenttypes.models import ContentType from django.contrib.sitemaps import ping_google #todo: maybe merge askbot.utils.markup and forum.utils.html from askbot.utils import markup -from askbot.utils.diff import textDiff +from askbot.utils.diff import textDiff as htmldiff from askbot.utils.html import sanitize_html from django.utils import html import logging @@ -126,10 +126,10 @@ def parse_and_save_post(post, author = None, **kwargs): #this save must precede saving the mention activity #because generic relation needs primary key of the related object if post.post_type != 'comment': - last_revision = post.get_latest_revision().as_html() + last_revision = post.revisions.all().order_by('-revised_at')[1].as_html(include_tags=False) super(post.__class__, post).save(**kwargs) - current_revision = post.get_latest_revision().as_html() - diff = textDiff(current_revision, last_revision) + current_revision = post.get_latest_revision().as_html(include_tags=False) + diff = htmldiff(last_revision, current_revision) else: #we get comments super(post.__class__, post).save(**kwargs) @@ -242,7 +242,7 @@ class ContentRevision(models.Model): abstract = True app_label = 'askbot' - def as_html(self): + def as_html(self, **kwargs): """should return html representation of the revision """ diff --git a/askbot/models/question.py b/askbot/models/question.py index df1698d3..330d3fdb 100644 --- a/askbot/models/question.py +++ b/askbot/models/question.py @@ -965,6 +965,8 @@ class FavoriteQuestion(models.Model): QUESTION_REVISION_TEMPLATE = ('

%(title)s

\n' '
%(html)s
\n' '
%(tags)s
') +QUESTION_REVISION_TEMPLATE_NO_TAGS = ('

%(title)s

\n' + '
%(html)s
\n') class QuestionRevision(ContentRevision): """A revision of a Question.""" question = models.ForeignKey(Question, related_name='revisions') @@ -983,14 +985,20 @@ class QuestionRevision(ContentRevision): #print 'in QuestionRevision.get_absolute_url()' return reverse('question_revisions', args=[self.question.id]) - def as_html(self): + def as_html(self, include_tags=True): markdowner = markup.get_parser() - return QUESTION_REVISION_TEMPLATE % { - 'title': self.title, - 'html': sanitize_html(markdowner.convert(self.text)), - 'tags': ' '.join(['%s' % tag - for tag in self.tagnames.split(' ')]), - } + if include_tags: + return QUESTION_REVISION_TEMPLATE % { + 'title': self.title, + 'html': sanitize_html(markdowner.convert(self.text)), + 'tags': ' '.join(['%s' % tag + for tag in self.tagnames.split(' ')]), + } + else: + return QUESTION_REVISION_TEMPLATE_NO_TAGS % { + 'title': self.title, + 'html': sanitize_html(markdowner.convert(self.text)) + } def save(self, **kwargs): """Looks up the next available revision number.""" diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css index 7214d52f..40475ec5 100644 --- a/askbot/skins/default/media/style/style.css +++ b/askbot/skins/default/media/style/style.css @@ -1453,6 +1453,10 @@ ins { background-color: #97ff97; } +ins p{ + background-color: #97ff97; +} + ins .post-tag { background-color: #97ff97; } @@ -2198,9 +2202,18 @@ img.gravatar { overflow:hidden; } +.response-parent { + margin-top: 18px; +} + +.response-parent strong{ + font-size: 20px; +} + .re { min-height: 57px; clear: both; + margin-top: 10px; } #responses input { diff --git a/askbot/skins/default/templates/user_profile/user_inbox.html b/askbot/skins/default/templates/user_profile/user_inbox.html index d2b422c3..4743a4c1 100644 --- a/askbot/skins/default/templates/user_profile/user_inbox.html +++ b/askbot/skins/default/templates/user_profile/user_inbox.html @@ -58,8 +58,9 @@ inbox_section - forum|flags {% endif %}
{% for response in responses %} +

- "{{ response.response_title|escape}}" + "{{ response.response_title.strip()|escape}}"

{% if response.nested_responses %} @@ -84,11 +85,12 @@ inbox_section - forum|flags {{ nested_response.response_type }} ({{ nested_response.timestamp|diff_date(3, True) }}):
- {{ nested_response.response_snippet }} + {{ nested_response.response_snippet}}
{%endfor%} {%endif%} +
{% endfor %} -- cgit v1.2.3-1-g7c22